Re: How to prevent vacuum and reindex from deadlocking.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Creager <Robert_Creager(at)LogicalChaos(dot)org>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to prevent vacuum and reindex from deadlocking.
Date: 2003-08-11 15:05:57
Message-ID: 2587.1060614357@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Robert Creager <Robert_Creager(at)LogicalChaos(dot)org> writes:
> So, my guess is that 18735 is the vacuum process (likely vacuum analyze, driven
> from pg_autovacuum), and 188735 is a 'REINDEX INDEX temp_obs_i_loc_index'.

Can you use a "REINDEX TABLE" instead? REINDEX INDEX is problematic
since it first finds/locks the index and then has to find/lock the
table. Everything else (except perhaps DROP INDEX) goes the other way.

If you really want to rebuild only the one index, I think this will work:

begin;
lock table tab;
reindex index ndx;
commit;

I don't see a good system-level solution to this other than changing the
REINDEX syntax to include the table name (cf. CLUSTER).

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oscar Estevez Lopez 2003-08-11 15:10:25 Re: extract and time zones
Previous Message Robert Creager 2003-08-11 14:40:17 Re: How to prevent vacuum and reindex from deadlocking.