Cold index: bound sorter memory for 1M-note Homes (temp_store=MEMORY follow-up) #837

Open
opened 2026-11-02 03:43:11 +00:00 by kayg · 0 comments
Owner

Follow-up from the #792 review (#issuecomment-74164, P2).

#792 switched the metadata sorter to SQLite temp_store=MEMORY, which removed 1.47M temp-file writes and got the 100k cold index to 1.248× dev. Measured peak RSS during a 100k cold index on dev-01 was C 175 MiB vs dev 186 MiB.

If the peak scales linearly, a 1M-note Home would peak around 1.7 GiB (estimate, not measured). Proposed fix:

  • bound the sorter's in-memory use: keep temp_store=MEMORY for Homes under a size threshold, or cap cache_size/use PRAGMA cache_spill so large sorts spill to a temp file;
  • or sort in bounded chunks during the cold scan.

Gate: measure peak RSS for a 1M cold index (seeded, dev-01), and keep the 100k cold-index ratio at ≤1.25× dev.

Follow-up from the #792 review (#issuecomment-74164, P2). #792 switched the metadata sorter to SQLite `temp_store=MEMORY`, which removed 1.47M temp-file writes and got the 100k cold index to 1.248× dev. Measured peak RSS during a 100k cold index on dev-01 was C 175 MiB vs dev 186 MiB. If the peak scales linearly, a 1M-note Home would peak around **1.7 GiB** (estimate, not measured). Proposed fix: - bound the sorter's in-memory use: keep `temp_store=MEMORY` for Homes under a size threshold, or cap `cache_size`/use `PRAGMA cache_spill` so large sorts spill to a temp file; - or sort in bounded chunks during the cold scan. **Gate:** measure peak RSS for a 1M cold index (seeded, dev-01), and keep the 100k cold-index ratio at ≤1.25× dev.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#837
No description provided.