Re: Online index builds

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Ragnar <gnari(at)hive(dot)is>, pgsql-general(at)postgresql(dot)org
Subject: Re: Online index builds
Date: 2006-12-12 23:08:41
Message-ID: 27313.1165964921@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general pgsql-www

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> You could create a whole new index concurrently, then in a completely new
> (third) transaction drop the old one. The problem there is that there could be
> other things (namely foreign key constraints) depending on the old index.
> Fixing them all to depend on the new one may not be a problem or it may, I
> haven't thought it through. Nor have I thought through whether it would be
> possible to keep the original name.

If the idea is to do REINDEX CONCURRENTLY then ISTM you could just swap
the relfilenodes of the two indexes and then zap the new catalog entries
(and old index contents). The problem is exactly the same as before,
though: you need exclusive lock to do that.

regards, tom lane

In response to

Responses

Browse pgsql-announce by date

  From Date Subject
Next Message Jeff Davis 2006-12-12 23:33:18 Re: Online index builds
Previous Message Gregory Stark 2006-12-12 23:04:46 Re: Online index builds

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-12-12 23:15:55 Re: indexed function performance
Previous Message Gregory Stark 2006-12-12 23:04:46 Re: Online index builds

Browse pgsql-www by date

  From Date Subject
Next Message Jeff Davis 2006-12-12 23:33:18 Re: Online index builds
Previous Message Gregory Stark 2006-12-12 23:04:46 Re: Online index builds