perf: make durable-delete flush compaction proportional (data-only + single-pass index rebuild) - #366
Merged
Conversation
added 2 commits
September 3, 2026 16:56
…single-pass index rebuild) The flush-time compaction added for durable Columnar deletes (#365) cost ~46s on a 100K-row table: CompactStorage compacted the overflow arena (46s) and rebuilt PK + each hash index with a separate full-file decode pass. CompactPendingDeletes now rewrites only the data file (CompactTable over the live PK positions) and rebuilds all indexes in ONE decode pass (RebuildAllIndexesFromFile) — the arena is left for a later explicit VACUUM/compact. Measured flush for delete-10k-of-100k: ~46s -> ~0.4s. CompactStorage (explicit compaction) also reuses the traversal + single-pass rebuild.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
#365 made Columnar deletes durable by compacting at flush, but it routed through
CompactStorage, which compacted the overflow arena (~46s for delete-10k-of-100k on a fixed-width table) and rebuilt PK + every hash index with separate full-file decode passes — DELETE collapsed to ~65 ops/s in the--pkharness.Fix
CompactPendingDeletesis now data-file only: it collects the live PK positions viaBTree.InOrderTraversal()(noSelect()row materialization), rewrites the.datviaAppendOnlyEngine.CompactTable, and leaves the overflow arena for a later explicit VACUUM/compact. Durability (deleted rows never resurrect after reopen) is preserved.RebuildAllIndexesFromFile()rebuilds the PK B-tree and every loaded hash index in one decode pass;CompactStorage(explicit compaction) reuses the traversal + single-pass rebuild too.Measured
Durable-delete flush on 100K-row table after deleting 10K rows: ~46s → ~0.4s.
Tests
Full suite 1656/1656;
DeletesPersistAcrossReopen_AfterFlushCompaction(durable delete) stays green.