Re: Trying to deal with a bloated index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jack Orenstein <jack(dot)orenstein(at)hds(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trying to deal with a bloated index
Date: 2009-02-19 21:43:26
Message-ID: 26349.1235079806@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jack Orenstein <jack(dot)orenstein(at)hds(dot)com> writes:
> - How well does the CONCURRENTLY option work? The documentation on REINDEX says
> "An index build with the CONCURRENTLY option failed ..." I'm not sure if I'm
> supposed to read this as a comment on the reliability of the CONCURRENTLY option.

No, you aren't. The point there is that CONCURRENTLY commits the
creation of an index and then some time later the index becomes valid.
If the system crashes in between you have a useless invalid index hanging
around. You could manually drop it and try again; REINDEX just provides
a different approach to fixing the problem.

AFAIK there aren't any particular reliability issues with CONCURRENTLY.

> - How much of a drag on performance will be caused by the creation of idx2?

You'd have to measure it in your environment, but if you haven't got
cycles and I/O to spare it's going to hurt.

> - How will the optimizer deal with this approach? When idx2 is ready and idx1 is
> dropped, will the optimizer immediately switch over? What about optimization of
> any prepared statements on connections whose lifetime spans the creation of idx2?

Dropping of idx1 will force invalidation of any plans using it.
Possibly more to the point, DROP INDEX takes exclusive lock on the
table, so if you have long-running queries that's going to be an issue.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Frank Featherlight 2009-02-19 21:44:19 Re: Service not starting during install
Previous Message Jack Orenstein 2009-02-19 20:58:23 Trying to deal with a bloated index