Re: Support for REINDEX CONCURRENTLY

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support for REINDEX CONCURRENTLY
Date: 2012-12-07 12:37:06
Message-ID: CAB7nPqRVz3iW9rnLsE4sBbjZVJqUGAf-M-X21q-mnaKGqVLT0g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Long time this thread has not been updated...
Please find attached the version 3 of the patch for support of REINDEX
CONCURRENTLY.
The code has been realigned with master up to commit da07a1e (6th December).

Here are the things modified:
- Improve code to use index_set_state_flag introduced by Tom in commit
3c84046
- One transaction is used for each index swap (N transactions if N indexes
reindexed at the same time)
- Fixed a bug to drop the old indexes concurrently at the end of process

The index swap is managed by switching the names of the new and old indexes
using RenameRelationInternal several times. This API takes an exclusive
lock on the relation that is renamed until the end of the transaction
managing the swap. This has been discussed in this thread and other
threads, but it is important to mention it for people who have not read the
patch.

There are still two things that are missing in this patch, but I would like
to have more feedback before moving forward:
- REINDEX CONCURRENTLY needs tests in src/test/isolation
- There is still a problem with toast indexes. If the concurrent reindex of
a toast index fails for a reason or another, pg_relation will finish with
invalid toast index entries. I am still wondering about how to clean up
that. Any ideas?

Comments?
--
Michael Paquier
http://michael.otacoo.com

Attachment Content-Type Size
20121207_reindex_concurrently_v3.patch application/octet-stream 56.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-12-07 12:38:37 Re: -DCLOBBER_CACHE_ALWAYS shows COPY FREEZE regression problem
Previous Message Albe Laurenz 2012-12-07 11:24:56 Re: [v9.3] writable foreign tables