Re: Cannot create unique index

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Henrik Steffen <steffen(at)city-map(dot)de>, Andrew Gould <andrewgould(at)yahoo(dot)com>, pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cannot create unique index
Date: 2003-07-01 13:04:35
Message-ID: 20030701130435.GA28181@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Unlikely. Create index takes a write lock on a table. Reindex takes an
exclusive lock (or something like that). Unless something really bad happens
it shouldn't be a problem.

I've had index corruption before. We're running 7.0 (upgrading Real Soon
Now) and there are certain situations that can corrupt indexes, mostly
involving backend segmentation faults. More recent versions should be quite
resiliant against this.

On Tue, Jul 01, 2003 at 06:50:36AM -0600, scott.marlowe wrote:
> how odd. Since reindex works by dropping the index then recreating it, is
> it possible that some process inserted duplicates in the split second
> there was no index?
>
> for safety's sake, I've always reindexed in a transaction:
>
> begin;
> drop index bubba;
> create index bubba on ...
> commit;

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> "the West won the world not by the superiority of its ideas or values or
> religion but rather by its superiority in applying organized violence.
> Westerners often forget this fact, non-Westerners never do."
> - Samuel P. Huntington

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gould 2003-07-01 13:11:30 Re: Create Data Base fails
Previous Message Yuriy Rusinov 2003-07-01 13:04:31 C++ functions under Windows