postgresql/src/backend/access
Peter Geoghegan e5adcb789d Refactor nbtree insertion scankeys.
Use dedicated struct to represent nbtree insertion scan keys.  Having a
dedicated struct makes the difference between search type scankeys and
insertion scankeys a lot clearer, and simplifies the signature of
several related functions.  This is based on a suggestion by Andrey
Lepikhov.

Streamline how unique index insertions cache binary search progress.
Cache the state of in-progress binary searches within _bt_check_unique()
for later instead of having callers avoid repeating the binary search in
an ad-hoc manner.  This makes it easy to add a new optimization:
_bt_check_unique() now falls out of its loop immediately in the common
case where it's already clear that there couldn't possibly be a
duplicate.

The new _bt_check_unique() scheme makes it a lot easier to manage cached
binary search effort afterwards, from within _bt_findinsertloc().  This
is needed for the upcoming patch to make nbtree tuples unique by
treating heap TID as a final tiebreaker column.  Unique key binary
searches need to restore lower and upper bounds.  They cannot simply
continue to use the >= lower bound as the offset to insert at, because
the heap TID tiebreaker column must be used in comparisons for the
restored binary search (unlike the original _bt_check_unique() binary
search, where scankey's heap TID column must be omitted).

Author: Peter Geoghegan, Heikki Linnakangas
Reviewed-By: Heikki Linnakangas, Andrey Lepikhov
Discussion: https://postgr.es/m/CAH2-WzmE6AhUdk9NdWBf4K3HjWXZBX3+umC7mH7+WDrKcRtsOw@mail.gmail.com
2019-03-20 09:30:57 -07:00
..
brin More unconstify use 2019-02-13 11:50:16 +01:00
common Fix memory leak in printtup.c. 2019-03-18 17:54:41 -04:00
gin Fix misc typos in comments. 2019-01-23 13:39:00 +02:00
gist tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
hash tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
heap Fold vacuum's 'int options' parameter into VacuumParams. 2019-03-18 13:57:33 -04:00
index tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
nbtree Refactor nbtree insertion scankeys. 2019-03-20 09:30:57 -07:00
rmgrdesc Fix description of WAL record XLOG_PARAMETER_CHANGE 2019-02-12 13:10:59 +09:00
spgist tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
table tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
tablesample tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
transam Refactor more code logic to update the control file 2019-03-18 12:59:35 +09:00
Makefile Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00