Repository navigation
Commit a25ced0
committed
docs(plan): DELETE has no cheap win left - the lever is deferred index maintenance (a decision, not a fix)
Continued item 1 by inspecting the two dominant DELETE buckets the split exposed, and the inspection removed
both candidate fixes:
- The classification path (parse 19.3%, 1.4us/statement) is already lean: IsInsertStatement is a span prefix
check, TryScanCanonicalDml is a quotes-aware span scan with NO regex, and both TryParseUpdateForBatch and
TryParseDeleteForBatch check their UPDATE/DELETE prefix BEFORE the regex fallback. The 1.4us is two canonical
scans plus list bookkeeping plus the profiler's own two Interlocked calls - there is no allocation or regex to
remove, so a "prepared DELETE statement" path would buy far less than the share suggests.
- index-maintenance (58.6%, 42.2 ms in SEVEN calls) is not the hash index either: RemoveBatchKeys already
defers duplicate-key removals and compacts in one pass, and BTree.DeleteBulk already sorts descending so
consecutive deletes ride the rightmost leaf chain. The cost is most plausibly the PK B-tree bulk delete
itself (10K individual deletes with separator promotions/rebalances), which is inherent to per-key deletion.
So the real lever is to stop doing index maintenance per key: write the tombstone and let the existing
tombstone-aware readers (ReadBytesFrom returns null on a negative prefix, ReadAllRecords skips the slot) and a
rebuild/compaction drop the stale entries - the same "defer the maintenance" shape the update path already uses
(DeferredIndexUpdater). That could remove most of the 58.6%, but it changes read-path behaviour for EVERY index
consumer (stale entries must be tolerated in the whole-file slice fast paths too) and needs a bounded rebuild
trigger. Deliberately not implemented here: it is a decision plus its own test matrix, not a micro-fix - which
is exactly what the plan's culture asks for.
No product code changed: measurement and documentation only. Gate unchanged (build 0 errors; suite 1857 / 0
failed / 16 skipped, with the one HashIndexPerformanceTests timing flake recorded).1 parent 66540a2 commit a25ced0
1 file changed
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1117 | 1117 | | |
1118 | 1118 | | |
1119 | 1119 | | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
1120 | 1141 | | |
1121 | 1142 | | |
1122 | 1143 | | |
| |||
0 commit comments