ron.l.johnson@xxxxxxx (Ron Johnson) writes: > On 10/16/07 08:21, hubert depesz lubaczewski wrote: >> hi, >> would it be possible for someone to add "last query" for >> pg_stat_activity view? >> >> there is a lot of cases that we have "idle in transaction" sitting for >> long time, and since we dont log all queries it is next to impossible to >> tell where in app code the problem lies. >> it would be very useful to get something like "previous query". > > Transaction analysis is the way to go here. It requires a serious > code review, though. > >> is adding something like this possible? I don't think it's likely to happen any time soon, certainly not for "legacy" versions of PostgreSQL. (e.g. - this might *conceivably* be material for version 8.4, but it won't be happening for any databases presently in production) On The Other Hand, the last time this happened and I got "called into action" (which wasn't terribly long ago), I did a search on pg_locks to see what locks the "<IDLE> in transaction" connection was holding onto, and that provided enough information for us to infer which part of the user code the system was in. -- (format nil "~S@~S" "cbbrowne" "linuxdatabases.info") http://linuxfinances.info/info/linuxdistributions.html Signs of a Klingon Programmer - 7. "Klingon function calls do not have 'parameters' - they have 'arguments' -- and they ALWAYS WIN THEM." ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend