diff options
author | Peter Geoghegan <pg@bowt.ie> | 2021-09-21 18:57:31 -0700 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2021-09-21 18:57:31 -0700 |
commit | e665129c4727004e7a7c12c86d077abc750b3307 (patch) | |
tree | 659400442906bc779376bbb1f1601e90612edf32 /src/include/access/nbtree.h | |
parent | 90251ff199858844fa450ba9614092c06c67fc4f (diff) |
Fix "single value strategy" index deletion issue.
It is not appropriate for deduplication to apply single value strategy
when triggered by a bottom-up index deletion pass. This wastes cycles
because later bottom-up deletion passes will overinterpret older
duplicate tuples that deduplication actually just skipped over "by
design". It also makes bottom-up deletion much less effective for low
cardinality indexes that happen to cross a meaningless "index has single
key value per leaf page" threshold.
To fix, slightly narrow the conditions under which deduplication's
single value strategy is considered. We already avoided the strategy
for a unique index, since our high level goal must just be to buy time
for VACUUM to run (not to buy space). We'll now also avoid it when we
just had a bottom-up pass that reported failure. The two cases share
the same high level goal, and already overlapped significantly, so this
approach is quite natural.
Oversight in commit d168b666, which added bottom-up index deletion.
Author: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/CAH2-WznaOvM+Gyj-JQ0X=JxoMDxctDTYjiEuETdAGbF5EUc3MA@mail.gmail.com
Backpatch: 14-, where bottom-up deletion was introduced.
Diffstat (limited to 'src/include/access/nbtree.h')
-rw-r--r-- | src/include/access/nbtree.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 42c66fac57c..30a216e4c0d 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -1155,7 +1155,7 @@ extern void _bt_parallel_advance_array_keys(IndexScanDesc scan); */ extern void _bt_dedup_pass(Relation rel, Buffer buf, Relation heapRel, IndexTuple newitem, Size newitemsz, - bool checkingunique); + bool bottomupdedup); extern bool _bt_bottomupdel_pass(Relation rel, Buffer buf, Relation heapRel, Size newitemsz); extern void _bt_dedup_start_pending(BTDedupState state, IndexTuple base, |