Re: Support for REINDEX CONCURRENTLY - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Support for REINDEX CONCURRENTLY
Date
Msg-id CAB7nPqT9n8nT5kAOBz0Ng+jGv6rRiFx33FsCknPdFZ6qkN6fsQ@mail.gmail.com
Whole thread Raw
In response to Re: Support for REINDEX CONCURRENTLY  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Support for REINDEX CONCURRENTLY  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Oct 3, 2012 at 5:10 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> 14) Swap new and old indexes, consisting here in switching their names.
I think switching based on their names is not going to work very well because
indexes are referenced by oid at several places. Swapping pg_index.indexrelid
or pg_class.relfilenode seems to be the better choice to me. We expect
relfilenode changes for such commands, but not ::regclass oid changes.
OK, if there is a choice to be made, switching  relfilenode would be a better choice as it points to the physical storage itself. It looks more straight-forward than switching oids, and takes the switch at the root.

Btw, there is still something I wanted to clarify. You mention in your ideas "old" and "new" indexes.
Such as we create a new index at the begininning and drop the old one at the end. This is not completely true in the case of switching relfilenode. What happens is that we create a new index with a new physical storage, then at swap step, we switch the old storage and the new storage. Once swap is done, the index that needs to be set as invalid and not ready is not the old index. but the index created at the beginning of process that has now the old relfilenode. Then the relation that is indeed dropped at the end of process is also the index with the old relfilenode, so the index created indeed at the beginning of process. I understand that this is playing with the words, but I just wanted to confirm that we are on the same line.
--
Michael Paquier
http://michael.otacoo.com

pgsql-hackers by date:

Previous
From: Ralf Rantzau
Date:
Subject: Question on "box @> point" using GiST index on boxes
Next
From: Tom Lane
Date:
Subject: Re: CREATE SCHEMA IF NOT EXISTS