pgsql: Avoid changing an index's indcheckxmin horizon during REINDEX.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid changing an index's indcheckxmin horizon during REINDEX.
Date: 2011-04-19 22:51:40
Message-ID: E1QCJlk-0004Ql-U1@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid changing an index's indcheckxmin horizon during REINDEX.

There can never be a need to push the indcheckxmin horizon forward, since
any HOT chains that are actually broken with respect to the index must
pre-date its original creation. So we can just avoid changing pg_index
altogether during a REINDEX operation.

This offers a cleaner solution than my previous patch for the problem
found a few days ago that we mustn't try to update pg_index while we are
reindexing it. System catalog indexes will always be created with
indcheckxmin = false during initdb, and with this modified code we should
never try to change their pg_index entries. This avoids special-casing
system catalogs as the former patch did, and should provide a performance
benefit for many cases where REINDEX formerly caused an index to be
considered unusable for a short time.

Back-patch to 8.3 to cover all versions containing HOT. Note that this
patch changes the API for index_build(), but I believe it is unlikely that
any add-on code is calling that directly.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8c19977e9c515cc29af449a7ab6c25e496f539f3

Modified Files
--------------
src/backend/bootstrap/bootstrap.c | 2 +-
src/backend/catalog/heap.c | 2 +-
src/backend/catalog/index.c | 38 ++++++++++++++++++++++++++++++------
src/backend/commands/cluster.c | 6 +++++
src/backend/commands/indexcmds.c | 2 +-
src/include/catalog/index.h | 3 +-
6 files changed, 42 insertions(+), 11 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-04-19 22:51:41 pgsql: Avoid changing an index's indcheckxmin horizon during REINDEX.
Previous Message Peter Eisentraut 2011-04-19 20:00:33 Re: [COMMITTERS] pgsql: Rename pg_regress option --multibyte to --encoding