Check what a transaction did in the past

Lists: pgsql-general
From: manugarciac <manugarciac(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Check what a transaction did in the past
Date: 2010-02-16 14:33:43
Message-ID: 27609195.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


I have an Idle in transaction that's really long. I suspect there is a
problem in my application, but I can't figure out where. If I new which
queries that transaction did in the past, it would really help me find the
problem. I know the transaction id, the process id, everything there is to
know, except the queries it did in the past. Is there any way to check this?
--
View this message in context: http://old.nabble.com/Check-what-a-transaction-did-in-the-past-tp27609195p27609195.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: manugarciac <manugarciac(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Check what a transaction did in the past
Date: 2010-02-16 16:27:51
Message-ID: 20100216162751.GH5330@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

manugarciac wrote:
>
> I have an Idle in transaction that's really long. I suspect there is a
> problem in my application, but I can't figure out where. If I new which
> queries that transaction did in the past, it would really help me find the
> problem. I know the transaction id, the process id, everything there is to
> know, except the queries it did in the past. Is there any way to check this?

Turn on log_statements and check the log.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: manugarciac <manugarciac(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Check what a transaction did in the past
Date: 2010-02-16 16:31:11
Message-ID: 328.1266337871@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> manugarciac wrote:
>> I have an Idle in transaction that's really long. I suspect there is a
>> problem in my application, but I can't figure out where. If I new which
>> queries that transaction did in the past, it would really help me find the
>> problem. I know the transaction id, the process id, everything there is to
>> know, except the queries it did in the past. Is there any way to check this?

> Turn on log_statements and check the log.

Note that log_statements alone isn't much help. You'll want to add at
least %p to log_line_prefix so that you can relate entries in the log
to currently active transactions.

regards, tom lane