From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | John Lumby <johnlumby(at)hotmail(dot)com> |
Cc: | Rui DeSousa <rui(at)crazybean(dot)net>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com> |
Subject: | Re: admin control over cancelling autovacuum when blocked by a lock |
Date: | 2019-04-30 21:03:30 |
Message-ID: | 25357.1556658210@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
John Lumby <johnlumby(at)hotmail(dot)com> writes:
> On 04/30/2019 04:34 PM, Rui DeSousa wrote:
>> Not really… analyze takes an exclusive lock; I believe. The result is
>> that readers/analyze will block other readers and writes which is bad
>> for concurrency. Readers should never be blocked :)…
> Apparently not - at least, not on the table being analyzed : from
> the 11.2 Reference :
> |ANALYZE| requires only a read lock on the target table, so it can run
> in parallel with other activity on the table.
That's kind of inaccurate. A moment's experimentation will show you
that what it really takes is ShareUpdateExclusiveLock, which it does
mostly to ensure that no other ANALYZE is running concurrently on the
same table. That lock type doesn't block ordinary reads or writes
on the table. It probably conflicts with autovacuum though ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Rui DeSousa | 2019-04-30 21:28:55 | Re: admin control over cancelling autovacuum when blocked by a lock |
Previous Message | John Lumby | 2019-04-30 20:46:33 | Re: admin control over cancelling autovacuum when blocked by a lock |