Re: Checks for command string

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Checks for command string
Date: 2006-01-02 00:55:15
Message-ID: 200601020055.k020tFG07078@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Doug Royer 2006-01-02 00:58:54 Re: EINTR error in SunOS
Previous Message Andrew Dunstan 2006-01-01 23:51:37 Re: psql & readline & win32

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2006-01-02 00:59:06 Re: [PATCHES] default resource limits
Previous Message Tom Lane 2006-01-01 17:42:21 Re: Checks for command string