From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: How to rebuild index efficiently
Date: Mon, 3 Aug 2020 13:04:45 -0500
Message-ID: <e5ae6787-3f28-5afe-29db-8b19026f7e16@gmail.com> (raw)
In-Reply-To: <5131947A-0470-46C0-93B8-7AE07BBC22FA@thebuild.com>
References: <CAGpkkhsXyBG-cFjXpPzsq8vdA6suDbq45PFXsVHVJ4==TLyuDA@mail.gmail.com>
<5131947A-0470-46C0-93B8-7AE07BBC22FA@thebuild.com>
On 8/3/20 12:58 PM, Christophe Pettus wrote
>> On Aug 3, 2020, at 10:20, Konireddy Rajashekar <rajkonireddy@gmail.com> wrote:
>> Could you please suggest any ideal approach to tackle this ?
> You can do CREATE INDEX CONCURRENTLY to build a new index with the same definition, and when that is complete, drop the old index. The locking that is required here is modest: CREATE INDEX CONCURRENTLY needs to lock the table briefly at a couple of points in the operation, and dropping the old index requires a brief lock on the table. It is, however, much less overall lock time than REINDEX would be.
Of course, you need enough disk space... :)
--
Angular momentum makes the world go 'round.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Re: How to rebuild index efficiently
In-Reply-To: <e5ae6787-3f28-5afe-29db-8b19026f7e16@gmail.com>
References: <CAGpkkhsXyBG-cFjXpPzsq8vdA6suDbq45PFXsVHVJ4==TLyuDA@mail.gmail.com> <5131947A-0470-46C0-93B8-7AE07BBC22FA@thebuild.com> <e5ae6787-3f28-5afe-29db-8b19026f7e16@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox