postgresql/src/backend
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
..
access Refactor nbtree insertion scankeys. 2019-03-20 09:30:57 -07:00
bootstrap tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
catalog Ignore attempts to add TOAST table to shared or catalog tables 2019-03-19 11:15:50 +01:00
commands Implement OR REPLACE option for CREATE AGGREGATE. 2019-03-19 01:16:50 +00:00
executor Enable parallel query with SERIALIZABLE isolation. 2019-03-15 17:47:04 +13:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
lib Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
libpq Add new clientcert hba option verify-full 2019-03-09 12:19:47 -08:00
main Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
nodes Fix copyfuncs/equalfuncs support for VacuumStmt. 2019-03-18 23:21:36 -04:00
optimizer Enable parallel query with SERIALIZABLE isolation. 2019-03-15 17:47:04 +13:00
parser Implement OR REPLACE option for CREATE AGGREGATE. 2019-03-19 01:16:50 +00:00
partitioning Update copyright year in files added by 1bb5e78218. 2019-03-16 16:00:38 +05:30
po Translation updates 2018-06-25 12:37:18 +02:00
port Add shared_memory_type GUC. 2019-02-03 12:47:26 +01:00
postmaster Make checkpoint requests more robust. 2019-03-19 12:49:27 -04:00
regex Update copyright for 2019 2019-01-02 12:44:25 -05:00
replication Add walreceiver API to get remote server version 2019-03-15 10:16:26 +01:00
rewrite tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
snowball Update copyright for 2019 2019-01-02 12:44:25 -05:00
statistics Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
storage Improve code comments in b0eaa4c51b. 2019-03-16 06:55:56 +05:30
tcop Implement OR REPLACE option for CREATE AGGREGATE. 2019-03-19 01:16:50 +00:00
tsearch Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
utils Refactor nbtree insertion scankeys. 2019-03-20 09:30:57 -07:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00