Re: Can autovac try to lock multiple tables at once?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Can autovac try to lock multiple tables at once?
Date: 2007-06-14 01:19:40
Message-ID: 20070614011940.GC4647@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> $subject would be bad because of potential deadlocks against other
> transactions that might try to exclusive-lock more than one table.
>
> We should be OK for actual vacuum operations, but I think that if
> autovac chooses to just ANALYZE multiple tables, it will do it in
> one transaction and accumulate locks. Probably the use_own_xacts
> logic in vacuum() ought to special-case IsAutoVacuumWorkerProcess.

Sure, it can do that. I think it's easy enough to correct this problem;
see attached patch. Should this be backpatched? Earlier releases also
fall foul of this problem AFAICT.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment Content-Type Size
av-analyze-ownxact.patch text/x-diff 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2007-06-14 01:47:42 Re: little PITR annoyance
Previous Message Andrew Dunstan 2007-06-13 23:35:55 Re: Bug in UTF8-Validation Code?