Re: Change pg_cancel_*() to ignore current backend - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: Change pg_cancel_*() to ignore current backend
Date
Msg-id 555FADAF.1050908@BlueTreble.com
Whole thread Raw
In response to Re: Change pg_cancel_*() to ignore current backend  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Change pg_cancel_*() to ignore current backend  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 5/22/15 4:51 PM, Tom Lane wrote:
> Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
>> On 5/22/15 3:08 PM, Eric Ridge wrote:
>>> Rather than change the behavior of pg_cancel/terminate_backend(), why not change pg_stat_activity to exclude the
currentsession?  Seems like showing a row in pg_stat_activity for "SELECT * FROM pg_stat_activity" is kinda useless
anyways.
>
>> Interesting idea. I suspect that would be even more invasive than
>> modifying the functions though...
>
> -1 ... some other columns in pg_stat_activity are potentially useful even
> for the current session, eg session and transaction start times.

AFAICT the only field you can get in pg_stat_activity and nowhere else 
is session start time (txn start is always now(), no?).

If that's the only objection about eliminating the current backend from 
pg_stat_activity then I'd say we should just add a session_start_time 
function to handle that.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: jsonb concatenate operator's semantics seem questionable
Next
From: Andres Freund
Date:
Subject: Re: Change pg_cancel_*() to ignore current backend