From: | Tatsuhito Kasahara <kasahara(dot)tatsuhito(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | display previous query string of idle-in-transaction |
Date: | 2009-03-25 09:08:43 |
Message-ID: | 49C9F49B.8020003@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi.
Now, we can check the running query string by pg_stat_activity.current_query.
If we can also check previous query_string of idle-in-transaction,
it is useful for analysis of long transaction problem.
Long-transaction is a trouble, because it prevents defragmentation of HOT and VACUUM.
And long-transaction tends to be it in a state of "idle in transaction".
(BEGIN -> SOME SQL -> .... (long-transactin) ....)
So, I sometimes want to know what query (main cause) was done before
transaction which have been practiced for a long time.
I think that we are glad when we can confirm it in the following form.
# We will be able to use debug_query_string in postgres.c for this purpose.
=================================================================
=# SELECT current_query FROM pg_stat_activity
WHERE procpid <> pg_backend_pid();
current_query
---------------------------------------------------------------
<IDLE> in transaction [prev]: SELECT * FROM pg_class limit 1;
=================================================================
Thoughts?
Best regards.
--
Tatsuhito Kasahara
kasahara(dot)tatsuhito(at)oss(dot)ntt(dot)co(dot)jp
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2009-03-25 09:32:12 | Re: New trigger option of pg_standby |
Previous Message | Guillaume Smet | 2009-03-25 08:55:49 | Re: New trigger option of pg_standby |