summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2020-06-19 08:57:23 -0700
committerPeter Geoghegan <pg@bowt.ie>2020-06-19 08:57:23 -0700
commitdedb92d4a3adc6b5165a619383739ab05d24b24d (patch)
treeebd7ceda6e2e05fc9f3e63baa1a04f5e07773a7e /src/include
parent08aa3151e7308556130c644c237fa4b20dfd6eba (diff)
Fix deduplication "single value" strategy bug.
It was possible for deduplication's single value strategy to mistakenly believe that a very small duplicate tuple counts as one of the six large tuples that it aims to leave behind after the page finally splits. This could cause slightly suboptimal space utilization with very low cardinality indexes, though only under fairly narrow conditions. To fix, be particular about what kind of tuple counts as a maxpostingsize-capped tuple. This avoids confusion in the event of a small tuple that gets "wedged" between two large tuples, where all tuples on the page are duplicates of the same value. Discussion: https://postgr.es/m/CAH2-Wz=Y+sgSFc-O3LpiZX-POx2bC+okec2KafERHuzdVa7-rQ@mail.gmail.com Backpatch: 13-, where deduplication was introduced (by commit 0d861bbb)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/nbtree.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index 3b2bcb22a70..79506c748b2 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -739,6 +739,7 @@ typedef struct BTDedupStateData
{
/* Deduplication status info for entire pass over page */
bool deduplicate; /* Still deduplicating page? */
+ int nmaxitems; /* Number of max-sized tuples so far */
Size maxpostingsize; /* Limit on size of final tuple */
/* Metadata about base tuple of current pending posting list */