Re: [ADMIN] Vacuum error on database postgres

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: andy <andy(at)squeakycode(dot)net>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [ADMIN] Vacuum error on database postgres
Date: 2006-09-14 20:35:29
Message-ID: 3024.1158266129@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
>> One possible fix today would be to make ANALYZE take
>> ShareUpdateExclusive lock instead, thus ensuring there is only one
>> ANALYZE at a time on a table.

> Why not an internal lock that people don't see?

We could add another LockTagType just for ANALYZE, but that seems like
rather a lot of infrastructure to support an extremely narrow corner
case, namely two people doing database-wide ANALYZE at the same time
inside transaction blocks. (If they do it outside a transaction block
then the ANALYZE is divided into multiple xacts and so doesn't try to
hold locks on multiple tables concurrently. autovacuum won't try to do
that either.) There's no such animal as "an internal lock people don't
see" --- if we went this way it'd propagate into user-visible entries in
pg_locks, for example.

ISTM it should be sufficient to use ShareUpdateExclusiveLock. The only
real argument I can see against it is you couldn't ANALYZE and VACUUM
a table at the same time ... but that's probably a bad idea anyway,
especially if we extend ANALYZE to estimate dead-tuple statistics.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tomeh, Husam 2006-09-14 21:51:23 Re: psql command
Previous Message Joshua D. Drake 2006-09-14 16:01:56 Re: [ADMIN] Vacuum error on database postgres

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-09-14 20:35:39 Re: Draft release notes
Previous Message Bruce Momjian 2006-09-14 20:34:44 Re: Draft release notes