perf: optimize API queries and add database indexes #347
No reviewers
Labels
No labels
auto-merged
ci
failed
component
api
good first issue
has-pr
help wanted
idea
priority
critical
priority
high
priority
low
priority
medium
review
approved
review
commented
status
blocked
status
in-progress
status
needs-review
status
ready
type
bug
type
chore
type
docs
type
enhancement
type
feature
type
refactor
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
customable/claude-mem!347
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/338-ui-performance"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
getProjectStats(): Replacelist()withcount()for session/observation/summary counts, use small sample (100) for token estimation instead of loading all recordsgetAnalyticsTypes(): Reduce limit from 100K to 5K — only needed for type distribution countsgetAnalyticsProjects(): Remove 1K observation load per project for token sums (was causing N+1-like overhead)getProjectFiles(): Reduce limit from 10K to 500 — only top 50 files are returned anywayTask(status, created_at),Session(project, status),Observation(project, type)for faster filtered queriesCloses #338
AI Code Review (Devstral)
The PR implements performance optimizations for API queries and adds database indexes. The changes align well with the linked issue #338, addressing excessive load times by reducing query limits and using count() instead of list() where appropriate. The added indexes will improve query performance on filtered data.
Automated review by pr-reviewer