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 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 why can

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 yo

Re: [HACKERS] Inconsistency between pg_stat_activity and log_duration

2014-02-07 Thread Tom Lane
Tatsuo Ishii 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 messages. It mig

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. >

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 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 >> field >> show

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 execu

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 wrote: > On Tue, Feb 4, 2014 at 9:36 AM, Tatsuo Ishii 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 e

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 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 12:47:11.24