Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Feb 12, 2016 at 6:22 PM, Andres Freund <andres@anarazel.de> wrote:
>> I wonder if we shouldn't just expose a 'which pid is process X waiting
>> for' API, implemented serverside. That's generally really useful, and
>> looks like it's actually going to be less complicated than that
>> query... And it's surely going to be faster.
> If PID 12000 and PID 13000 hold AccessShareLock on relation foo, and
> PID 14000 awaits AccessExclusiveLock on that relation, what does the
> function return when 14000 is passed as an argument?
Yeah. In general, it's not that easy to say that A is waiting
specifically on B --- there may be multiple blockers and/or multiple ways
it could get released. isolationtester's query is not really correct
IMO. It's okay as long as nothing else besides autovacuum is taking
locks, but I wouldn't want to try to make it work in a general purpose
environment.
regards, tom lane