Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group