postgresql/src/backend
Robert Haas 6d46f4783e Improve hash index bucket split behavior.
Previously, the right to split a bucket was represented by a
heavyweight lock on the page number of the primary bucket page.
Unfortunately, this meant that every scan needed to take a heavyweight
lock on that bucket also, which was bad for concurrency.  Instead, use
a cleanup lock on the primary bucket page to indicate the right to
begin a split, so that scans only need to retain a pin on that page,
which is they would have to acquire anyway, and which is also much
cheaper.

In addition to reducing the locking cost, this also avoids locking out
scans and inserts for the entire lifetime of the split: while the new
bucket is being populated with copies of the appropriate tuples from
the old bucket, scans and inserts can happen in parallel.  There are
minor concurrency improvements for vacuum operations as well, though
the situation there is still far from ideal.

This patch also removes the unworldly assumption that a split will
never be interrupted.  With the new code, a split is done in a series
of small steps and the system can pick up where it left off if it is
interrupted prior to completion.  While this patch does not itself add
write-ahead logging for hash indexes, it is clearly a necessary first
step, since one of the things that could interrupt a split is the
removal of electrical power from the machine performing it.

Amit Kapila.  I wrote the original design on which this patch is
based, and did a good bit of work on the comments and README through
multiple rounds of review, but all of the code is Amit's.  Also
reviewed by Jesper Pedersen, Jeff Janes, and others.

Discussion: http://postgr.es/m/CAA4eK1LfzcZYxLoXS874Ad0+S-ZM60U9bwcyiUZx9mHZ-KCWhw@mail.gmail.com
2016-11-30 15:39:21 -05:00
..
access Improve hash index bucket split behavior. 2016-11-30 15:39:21 -05:00
bootstrap Support condition variables. 2016-11-22 14:27:11 -05:00
catalog Fix test about ignoring extension dependencies during extension scripts. 2016-11-26 13:31:35 -05:00
commands Check for pending trigger events on far end when dropping an FK constraint. 2016-11-25 13:44:47 -05:00
executor Fix typo in comment 2016-11-25 13:06:19 +01:00
foreign Remove GetUserMappingId() and GetUserMappingById(). 2016-07-22 11:32:23 -04:00
lib Clarify the new Red-Black post-order traversal code a bit. 2016-09-04 15:02:06 +03:00
libpq Consistently mention 'SELECT pg_reload_conf()' in config files 2016-10-25 11:26:15 -04:00
main Remove barrier.h 2016-11-22 20:28:24 -05:00
nodes Implement syntax for transition tables in AFTER triggers. 2016-11-04 10:49:50 -05:00
optimizer Fix bogus handling of JOIN_UNIQUE_OUTER/INNER cases for parallel joins. 2016-11-29 19:32:35 -05:00
parser Improve handling of "UPDATE ... SET (column_list) = row_constructor". 2016-11-22 15:20:10 -05:00
po Translation updates 2016-08-08 11:08:00 -04:00
port Try to find out the actual hugepage size when making a MAP_HUGETLB request. 2016-10-13 15:06:46 -04:00
postmaster Code review for early drop of orphaned temp relations in autovacuum. 2016-11-27 21:23:39 -05:00
regex Make locale-dependent regex character classes work for large char codes. 2016-09-05 17:06:29 -04:00
replication Support condition variables. 2016-11-22 14:27:11 -05:00
rewrite Cleanup of rewriter and planner handling of Query.hasRowSecurity flag. 2016-11-10 16:16:33 -05:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Remove barrier.h 2016-11-22 20:28:24 -05:00
tcop Remove or reduce verbosity of some debug messages. 2016-11-17 17:05:16 -05:00
tsearch Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
utils Improve hash index bucket split behavior. 2016-11-30 15:39:21 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk
Makefile Straighten out some whitespace 2016-11-29 15:08:14 -05:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00