Re: Online index builds

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ragnar <gnari(at)hive(dot)is>, pgsql-general(at)postgresql(dot)org
Subject: Re: Online index builds
Date: 2006-12-08 00:31:56
Message-ID: 1165537916.13953.10.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general pgsql-www

On Thu, 2006-12-07 at 18:51 -0500, Tom Lane wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> > After reading through the archives, it looks like Gregory Stark
> > suggested a REINDEX CONCURRENTLY, which would certainly solve the
> > awkwardness of maintenance on a primary key. I didn't see much
> > objection, maybe it's worth consideration for 8.3?
>
> That idea was bounced on the grounds that it requires a DROP INDEX to
> occur somewhere, and that can't be concurrent, and you'd surely not like
> to go through all the work of a CONCURRENTLY rebuild only to get a
> deadlock failure at the very end.
>

I don't understand. CREATE INDEX CONCURRENTLY can't be run in a
transaction block anyway, so a REINDEX CONCURRENTLY wouldn't either. So
how (or when) would you deadlock?

I see it as the following logical operations:
(1) CREATE INDEX CONCURRENTLY tmp;
(2) swap the relfilenode of the old index and new index
(3) DROP INDEX tmp;

If this was all already hashed out on -hackers, you can point me to the
discussion if it's easier.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-announce by date

  From Date Subject
Next Message Tom Lane 2006-12-08 00:44:10 Re: Online index builds
Previous Message Ragnar 2006-12-08 00:05:02 Re: Online index builds

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-12-08 00:44:10 Re: Online index builds
Previous Message Ragnar 2006-12-08 00:05:02 Re: Online index builds

Browse pgsql-www by date

  From Date Subject
Next Message Tom Lane 2006-12-08 00:44:10 Re: Online index builds
Previous Message Ragnar 2006-12-08 00:05:02 Re: Online index builds