Re: Let's invent a function to report lock-wait-blocking PIDs - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Let's invent a function to report lock-wait-blocking PIDs
Date
Msg-id 514C26C1.1020001@vmware.com
Whole thread Raw
In response to Re: Let's invent a function to report lock-wait-blocking PIDs  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Let's invent a function to report lock-wait-blocking PIDs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 21.03.2013 05:36, Tom Lane wrote:
> Simon Riggs<simon@2ndQuadrant.com>  writes:
>> On 20 March 2013 18:02, Tom Lane<tgl@sss.pgh.pa.us>  wrote:
>>> The API that comes to mind is (name subject to
>>> bikeshedding)
>>>
>>> pg_blocking_pids(pid int) returns int[]
>
>> Useful. Can we also have an SRF rather than an array?
>
> I thought about that, but at least for the isolationtester use-case,
> the array result is clearly easier to use.  You can get from one to the
> other with unnest() or array_agg(), so I don't really feel a need to
> provide both.  Can you generate use-cases where the set-result approach
> is superior?

How about inverting the function into:

pg_pid_blocked_by(pid int) returns int

It would take as argument a pid, and return the pid of the process that 
is blocking the given process. That would feel more natural to me.

- Heikki



pgsql-hackers by date:

Previous
From: Atri Sharma
Date:
Subject: Re: Page replacement algorithm in buffer cache
Next
From: Amit Kapila
Date:
Subject: Re: Page replacement algorithm in buffer cache