You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Request]: Store: order sorted and filtered lists in SQL near the 10,000-record maximum #951
Split out of #902 item 5 so #902 can close on what it built.
A sorted or filtered store list reads every record in scope and orders it in memory, synchronously. The measurement in #882 (docs/CAPACITY.md, "Measured: the SQLite store"; Apple M4 Pro, Node 26.10, SQLite 3.53.4) found:
at the default maxRecords of 1,000, sort=title takes about 1.3 ms at p50 for a 100-record page, which is fine;
at the 10,000-record maximum (LIMITS.records), each sorted list holds the event loop for about 9 ms, and 16 concurrent sorted lists answer at 152 ms p50 / 712 ms p99 (about 80 lists/s in one process). Unsorted lists stay under 1.3 ms at p99.
maxRecords: 10000 is allowed, and the store-booking and store-credits recipes declare it. So a collection with sortable or filterable fields at that size queues sorted lists behind each other and behind every write.
Proposed behavior and alternatives
Order (and filter) in SQL for sortable fields, per #882's recommendation:
one index per sortable field, built from the declaration like the intervals index;
a collation that matches the documented UTF-16 code-unit order, since SQLite's byte order does not;
the same cursors, total and results as today, proved by running the existing query tests against both paths.
#882 measured SQL ordering at about 3x faster without an index and about 30x with one, comparing cost only (byte order, not UTF-16 order).
Alternatives: keep in-memory ordering and document the 10k ceiling for sorted traffic (today's state), or lower LIMITS.records for collections that declare sortable.
Not measured: the index's write cost, and the Linux numbers.
Activity
test(store): measure the plumbing declared intervals and transfers re…
feat(store): order and filter store lists in SQL (#951) (#986)
fix(store): owner ids only to members; transfers independent of the r…
docs: store and extension storage docs match the code (#993) (#1004)