display previous query string of idle-in-transaction
От | Tatsuhito Kasahara |
---|---|
Тема | display previous query string of idle-in-transaction |
Дата | |
Msg-id | 49C9F49B.8020003@oss.ntt.co.jp обсуждение исходный текст |
Ответы |
Re: display previous query string of idle-in-transaction
Re: display previous query string of idle-in-transaction Re: display previous query string of idle-in-transaction |
Список | 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 limit1; ================================================================= Thoughts? Best regards. -- Tatsuhito Kasahara kasahara.tatsuhito@oss.ntt.co.jp
В списке pgsql-hackers по дате отправления: