perf(index): remove quadratic duplicate-key hash removal on batch DELETE (P5) - #378
Merged
Merged
Conversation
…ETE (P5) HashIndex.RemoveBatchKeys/RemoveBatch removed every position from a key's List with one O(list) List.Remove shift per duplicate: O(m·n) for a key holding n rows with m duplicate-key deletions in a single batch. Batch removal now keeps the direct allocation-free path for single-row keys (the common unique-key case, verified benchmark-neutral at ~80K legacy / ~133K fixed-width ops/s on --pk) and defers duplicate-key positions into a per-key set that is applied with one O(list) compaction per key. Regression tests (HashIndexDuplicateKeyBatchDeleteTests) cover full and partial duplicate-group deletes on both index backends (managed List + unsafe native) including a reopen; full suite 1764 tests, 0 failed.
|
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.



Samenvatting
Duplicate-key hash-index removal op batch-DELETE is niet langer kwadratisch (P5).
HashIndex.RemoveBatchKeys(en hetRemoveBatch-rij-overload) deden per positie eenList.Remove:voor een key met n rijen en m duplicate-key deletes in één batch was dat O(m·n) door de lineaire
shift per duplicate. Nu:
allocatie-vrije weg —
list.Remove+ key-opruiming bij leeg.verwijdering direct, latere posities gedeferred in een per-key set, daarna één O(list)-compaction
per key (
CompactPositionList, value-based).Validatie
HashIndexDuplicateKeyBatchDeleteTests: volle én partiële duplicate-groepdeletes (2000 rijen, 10 naamgroepen van 200), beide index-backends (managed
List+unsafe native backend via
EnableUnsafeEqualityIndex), inclusief reopen.--pk: legacy ~80K, fixed-width ~133K ops/s —binnen de ruis van perf(delete): batch commit-time tombstone marker writes per storage page (C5) #377).