postgresql/src/include/access
Peter Geoghegan fab2502433 Consider secondary factors during nbtree splits.
Teach nbtree to give some consideration to how "distinguishing"
candidate leaf page split points are.  This should not noticeably affect
the balance of free space within each half of the split, while still
making suffix truncation truncate away significantly more attributes on
average.

The logic for choosing a leaf split point now uses a fallback mode in
the case where the page is full of duplicates and it isn't possible to
find even a minimally distinguishing split point.  When the page is full
of duplicates, the split should pack the left half very tightly, while
leaving the right half mostly empty.  Our assumption is that logical
duplicates will almost always be inserted in ascending heap TID order
with v4 indexes.  This strategy leaves most of the free space on the
half of the split that will likely be where future logical duplicates of
the same value need to be placed.

The number of cycles added is not very noticeable.  This is important
because deciding on a split point takes place while at least one
exclusive buffer lock is held.  We avoid using authoritative insertion
scankey comparisons to save cycles, unlike suffix truncation proper.  We
use a faster binary comparison instead.

Note that even pg_upgrade'd v3 indexes make use of these optimizations.
Benchmarking has shown that even v3 indexes benefit, despite the fact
that suffix truncation will only truncate non-key attributes in INCLUDE
indexes.  Grouping relatively similar tuples together is beneficial in
and of itself, since it reduces the number of leaf pages that must be
accessed by subsequent index scans.

Author: Peter Geoghegan
Reviewed-By: Heikki Linnakangas
Discussion: https://postgr.es/m/CAH2-WzmmoLNQOj9mAD78iQHfWLJDszHEDrAzGTUMG3mVh5xWPw@mail.gmail.com
2019-03-20 10:12:19 -07:00
..
amapi.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
amvalidate.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
attnum.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
brin.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
brin_internal.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
brin_page.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
brin_pageops.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
brin_revmap.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
brin_tuple.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
brin_xlog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
bufmask.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
clog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
commit_ts.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
genam.h tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
generic_xlog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
gin.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
gin_private.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
ginblock.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
ginxlog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
gist.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
gist_private.h Support for INCLUDE attributes in GiST indexes 2019-03-10 11:37:17 +03:00
gistscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
gistxlog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
hash.h Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
hash_xlog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
heapam.h Fold vacuum's 'int options' parameter into VacuumParams. 2019-03-18 13:57:33 -04:00
heapam_xlog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
hio.h Don't include heapam.h from others headers. 2019-01-14 16:24:41 -08:00
htup.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
htup_details.h Fix heap_getattr() handling of fast defaults. 2019-02-06 01:09:32 -08:00
itup.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
multixact.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nbtree.h Consider secondary factors during nbtree splits. 2019-03-20 10:12:19 -07:00
nbtxlog.h Make heap TID a tiebreaker nbtree index column. 2019-03-20 10:04:01 -07:00
parallel.h Enable parallel query with SERIALIZABLE isolation. 2019-03-15 17:47:04 +13:00
printsimple.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
printtup.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
relation.h Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00
reloptions.h Finish reverting "recheck_on_update" patch. 2019-01-15 12:07:10 -05:00
relscan.h tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
rewriteheap.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
rmgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
rmgrlist.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
sdir.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
session.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
skey.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
slru.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
spgist.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
spgist_private.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
spgxlog.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
stratnum.h Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
subtrans.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
sysattr.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
table.h Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00
tableam.h Remove spurious return. 2019-03-11 15:04:00 -07:00
timeline.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
transam.h Sync commentary in transam.h and bki.sgml. 2019-03-14 00:23:40 -04:00
tsmapi.h Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
tupconvert.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tupdesc.h Make naming of tupdesc related structs more consistent with the rest of PG. 2019-01-14 16:25:50 -08:00
tupdesc_details.h Make naming of tupdesc related structs more consistent with the rest of PG. 2019-01-14 16:25:50 -08:00
tupmacs.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tuptoaster.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
twophase.h Make release of 2PC identifier and locks consistent in COMMIT PREPARED 2019-02-25 14:19:34 +09:00
twophase_rmgr.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
valid.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
visibilitymap.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
xact.h Simplify restriction handling of two-phase commit for temporary objects 2019-01-26 10:45:23 +09:00
xlog.h Make checkpoint requests more robust. 2019-03-19 12:49:27 -04:00
xlog_internal.h Move max_wal_senders out of max_connections for connection slot handling 2019-02-12 10:07:56 +09:00
xlogdefs.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
xloginsert.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
xlogreader.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
xlogrecord.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
xlogutils.h Update copyright for 2019 2019-01-02 12:44:25 -05:00