Re: display previous query string of idle-in-transaction
От
Gurjeet Singh
Тема
Re: display previous query string of idle-in-transaction
Дата
Msg-id
65937bea0903250259t15698470k8a8c92501c6b4778@mail.gmail.com
Ответ на
display previous query string of idle-in-transaction (Tatsuhito Kasahara)
Список
Дерево обсуждения
display previous query string of idle-in-transaction Tatsuhito Kasahara <kasahara.tatsuhito@oss.ntt.co.jp>
Re: display previous query string of idle-in-transaction Simon Riggs <simon@2ndQuadrant.com>
Re: display previous query string of idle-in-transaction Tatsuhito Kasahara <kasahara.tatsuhito@oss.ntt.co.jp>
Re: display previous query string of idle-in-transaction Simon Riggs <simon@2ndQuadrant.com>
Re: display previous query string of idle-in-transaction Tatsuhito Kasahara <kasahara.tatsuhito@oss.ntt.co.jp>
Re: display previous query string of idle-in-transaction Simon Riggs <simon@2ndQuadrant.com>
Re: display previous query string of idle-in-transaction Guillaume Smet <guillaume.smet@gmail.com>
Re: display previous query string of idle-in-transaction decibel <decibel@decibel.org>
Re: display previous query string of idle-in-transaction Asko Oja <ascoja@gmail.com>
Re: display previous query string of idle-in-transaction Greg Stark <stark@enterprisedb.com>
Re: display previous query string of
idle-in-transaction "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: display previous query string of idle-in-transaction Tatsuhito Kasahara <kasahara.tatsuhito@oss.ntt.co.jp>
Re: display previous query string of idle-in-transaction Robert Haas <robertmhaas@gmail.com>
Re: display previous query string of idle-in-transaction daveg <daveg@sonic.net>
Re: display previous query string of
idle-in-transaction "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: display previous query string of idle-in-transaction Robert Haas <robertmhaas@gmail.com>
Re: display previous query string of idle-in-transaction Tom Lane <tgl@sss.pgh.pa.us>
Re: display previous query string of idle-in-transaction Peter Eisentraut <peter_e@gmx.net>
Re: display previous query string of idle-in-transaction Robert Haas <robertmhaas@gmail.com>
Re: display previous query string of
idle-in-transaction "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: display previous query string of idle-in-transaction Guillaume Smet <guillaume.smet@gmail.com>
Re: display previous query string of idle-in-transaction Guillaume Smet <guillaume.smet@gmail.com>
Re: display previous query string of idle-in-transaction Tatsuhito Kasahara <kasahara.tatsuhito@oss.ntt.co.jp>
Re: display previous query string of idle-in-transaction hubert depesz lubaczewski <depesz@depesz.com>
Re: display previous query string of idle-in-transaction Guillaume Smet <guillaume.smet@gmail.com>
Re: display previous query string of idle-in-transaction Tatsuhito Kasahara <kasahara.tatsuhito@oss.ntt.co.jp>
Re: display previous query string of idle-in-transaction ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Re: display previous query string of idle-in-transaction Tatsuhito Kasahara <kasahara.tatsuhito@oss.ntt.co.jp>
Re: display previous query string of idle-in-transaction Gurjeet Singh <singh.gurjeet@gmail.com>
This sure is a desirable feature. I have seen quite a few instances, where the app is in 'IDLE in Transaction' state, and we are left with the only choice of killing such processes from OS. (Remember pg_cancel_backend() does not work for sessions in IDLE or IDLE in transaction state)
Also, it should be introduced as a new column, rather than tacking on the existing string. Although this column will be of little use in cases where current query is visible, but having a separate column looks like a cleaner and simpler implementation.
Best regards,
--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com
EnterpriseDB http://www.enterprisedb.com
Mail sent from my BlackLaptop device
Also, it should be introduced as a new column, rather than tacking on the existing string. Although this column will be of little use in cases where current query is visible, but having a separate column looks like a cleaner and simpler implementation.
Best regards,
2009/3/25 Tatsuhito Kasahara <kasahara.tatsuhito@oss.ntt.co.jp>
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.tatsuhito@oss.ntt.co.jp
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com
EnterpriseDB http://www.enterprisedb.com
Mail sent from my BlackLaptop device
В списке pgsql-hackers по дате отправления