Search Postgresql Archives

Re: unique index corruption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 24, 2013 at 1:50 PM, pg noob <pgnube@xxxxxxxxx> wrote:
>
> Hi all,
>
> In PostgreSQL 8.4...
>
> I am wondering if autovacuum will periodically rebuild indexes?

it will not. REINDEX requires a heavy lock and for most applications
it would be just plain untenable to be run without some type of
application coordination, especially if the index is large.

> If not, how advisable is it to reindex periodically?

no harm in that at all -- notwithstanding the locking issues.

> We recently had a case of unique index corruption which ended up allowing
> duplicate
> primary key IDs to get inserted and caused widespread data model integrity
> havoc.
>
> The system ran for several days before it was noticed.
>
> After the problem was discovered we found that a reindex would fail because
> there were
> duplicate ID values.
>
> Our thought is that if we had a scheduled cron job that would periodically
> do a reindex this
> corruption might have been caught sooner by detecting the reindex failure.
>
> If a reindex is something that should be done frequently as part of regular
> maintenance
> why isn't there a mode of autovacuum that does this automatically?  Or maybe
> there is and
> I just don't know about it..?


REINDEX to remove corruption is essentially dealing with the symptoms
of a problem and IMNSHO is not a real long term solution. First thing
to figure out is if we have a postgres bug or some other failure (in
particular, hardware).   Unusual circumstances, for example any
unplanned shutdowns around the time corruption started to appear,
might give some clues in terms of figuring where the real problem
lies.  Essentially this is not supposed to happen.

merlin


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux