Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Does anyone know why we test for pgstat_collect_querystring in routines
> > that obviously dump only block and row-level statistics and database
> > commit/rollback total?
>
> Because we want commits/rollbacks to be counted if any of them are on.
Why do we want commits/rollbacks counted if we only have command string
enabled? Here is the test:
if (pgStatSock < 0 ||
!(pgstat_collect_querystring ||
pgstat_collect_tuplelevel ||
pgstat_collect_blocklevel))
and here are the functions that have it where I think it is wrong:
pgstat_report_tabstat()
pgstat_count_xact_commit()
pgstat_count_xact_rollback()
The stats_command_string documention makes no mention of this:
Enables the collection of statistics on the currently
executing command of each session, along with the time at
which that command began execution. This option is off by
default. Note that even when enabled, this information is not
visible to all users, only to superusers and the user owning
the session being reported on; so it should not represent a
security risk. This data can be accessed via the
<structname>pg_stat_activity</structname> system view; refer
to <xref linkend="monitoring"> for more information.
Seems we should document this somewhere even if the behavior is correct,
which I don't think it is.
The !(x || y) construct is really ugly and I will fix that in a simple
commit now.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073