Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-09 Thread Amit Kapila
On Fri, Feb 7, 2014 at 2:44 PM, Tatsuo Ishii is...@postgresql.org wrote: One idea is, calling pgstat_report_activity(STATE_IDLE) in exec_execute_message() of postgres.c. The function has already called pgstat_report_activity(STATE_RUNNING) which shows active state in pg_stat_actviity view. So

Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-07 Thread Tatsuo Ishii
One idea is, calling pgstat_report_activity(STATE_IDLE) in exec_execute_message() of postgres.c. The function has already called pgstat_report_activity(STATE_RUNNING) which shows active state in pg_stat_actviity view. So why cann't we call pgstat_report_activity(STATE_IDLE) here. Somebody

Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-07 Thread Tom Lane
Tatsuo Ishii is...@postgresql.org writes: The argument here could be do we really need a new state for such a short window between completion of 'E' message and processing of 'S' sync message considering updation of state is not a very light call which can be called between processing of 2

Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-07 Thread Tatsuo Ishii
The query is piggy backed on the same connection to PostgreSQL opend by user (pgpool-II cannot issue sync because it closes the transaction, which in turn closes user's unnamed portal). This argument (and usage) seems pretty broken. If you don't issue sync then how do you know you've

Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-06 Thread Amit Kapila
On Tue, Feb 4, 2014 at 9:36 AM, Tatsuo Ishii is...@postgresql.org wrote: As you can see, at 2014-02-04 12:47:27.210981+09 the query SELECT count(*) FROM pg_catalog.pg_class... is active and it seems still running. On the other side, Here is an excerpt from PostgreSQL log: 21850 2014-02-04

Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-06 Thread Amit Kapila
On Fri, Feb 7, 2014 at 10:43 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Tue, Feb 4, 2014 at 9:36 AM, Tatsuo Ishii is...@postgresql.org wrote: As you can see, at 2014-02-04 12:47:27.210981+09 the query SELECT count(*) FROM pg_catalog.pg_class... is active and it seems still running. On

Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-06 Thread Tatsuo Ishii
I think that is the probable reason for the above mentioned behaviour. As I understand here, the problem is that 'state' of backend is shown as active along with 'query' which according to docs (If state is active this field shows the currently executing query.) means that query is

Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-06 Thread Amit Kapila
On Fri, Feb 7, 2014 at 11:46 AM, Tatsuo Ishii is...@postgresql.org wrote: I think that is the probable reason for the above mentioned behaviour. As I understand here, the problem is that 'state' of backend is shown as active along with 'query' which according to docs (If state is active this

[HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-03 Thread Tatsuo Ishii
I found an interesting inconsistency between pg_stat_activity and log_duration. -[ RECORD 1 ]+--- datid| 16392 datname | test pid | 21815