Frontmatter
| id | 8203 |
| title | Optimizing `SummaryService.listSummaries` with Two-Phase Fetch |
| state | Closed |
| labels | enhancementairefactoringperformance |
| assignees | tobiu |
| createdAt | Dec 29, 2025, 11:13 PM |
| updatedAt | Dec 29, 2025, 11:24 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8203 |
| author | tobiu |
| commentsCount | 2 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Dec 29, 2025, 11:24 PM |
Optimizing SummaryService.listSummaries with Two-Phase Fetch
tobiu assigned to @tobiu on Dec 29, 2025, 11:13 PM

tobiu
Dec 29, 2025, 11:14 PM
cross reference link: https://github.com/chroma-core/chroma/issues/469 => it is sad to see that the ordering feature never got implemented.

tobiu
Dec 29, 2025, 11:24 PM
Implemented the two-phase fetch strategy to ensure correct global sorting and pagination of session summaries. Phase 1 fetches lightweight metadata for sorting, and Phase 2 fetches the full documents for the target slice, using a Map for O(1) re-assembly to preserve order.
tobiu closed this issue on Dec 29, 2025, 11:24 PM
ChromaDB lacks a native
ORDER BYclause for metadata. The current implementation fetches all documents (limit 50), which prevents accessing older sessions and is unscalable.Proposed Solution: Two-Phase Fetch Pattern To achieve efficient, SQL-like pagination without native DB support:
idsandmetadatasfor ALL sessions.document(text) field.timestamp(DESC).offsetandlimitto the sorted array to identify the target IDs.documentsfor ONLY the sliced IDs.Benefits: