Re: Online index builds

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>, Ragnar <gnari(at)hive(dot)is>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Online index builds
Date: 2006-12-13 10:05:56
Message-ID: 1166004356.13028.94.camel@coppola.muc.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general pgsql-www

> Yeah, we could add defenses one by one for the cases we could think of,
> but I'd never feel very secure that we'd covered them all.

What you all forget in this discussion is that reindexing concurrently
would have to be a highly administrative task, controlled by the DB
admin... so whoever has a big index to be reindexed can schedule it so
that no other schema changes occur to the table until the reindex is
finished.

So an implementation which optimistically builds the new index
concurrently while holding no lock, and then hopes for the 3rd
transaction to be able to get the exclusive lock and be able to swap the
new index in the place of the old index, and error out if it can't - it
is perfectly acceptable. The waisted effort when dropping the newly
created index on error is easily avoidable by not doing anything which
would cause an error in that phase... and it is easily controlled by the
DBA. The only thing needed is documentation to point it out.

I didn't understand completely the discussion here, and if there are
some problems detecting the error conditions in the index swap phase,
that's a problem... but if it is possible to reliably detect cases where
the swap is not possible because something changed in between, erroring
out will be acceptable for the purpose of this command...

Cheers,
Csaba.

In response to

Responses

Browse pgsql-announce by date

  From Date Subject
Next Message Ragnar 2006-12-13 10:39:10 Re: Online index builds
Previous Message Jeff Davis 2006-12-13 00:38:38 Re: Online index builds

Browse pgsql-general by date

  From Date Subject
Next Message Brandon Aiken 2006-12-13 10:30:29 Re: PG Admin
Previous Message peter pilsl 2006-12-13 09:50:14 Re: order by text-type : whitespaces ignored??

Browse pgsql-www by date

  From Date Subject
Next Message Ragnar 2006-12-13 10:39:10 Re: Online index builds
Previous Message Dave Page 2006-12-13 08:54:40 Re: Hub.org DNS