Re: pg_stat_statements produces multiple entries for a single query with track = 'top'

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_stat_statements produces multiple entries for a single query with track = 'top'
Date: 2013-08-11 01:00:51
Message-ID: CAM3SWZTftnL5C2THwr49WkX6U60Fe86ujuup544YQ33jZterdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Aug 10, 2013 at 5:45 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Isn't this just the behavior we decided we wanted for SQL-language
> functions? At least, if we change pg_stat_statements so it doesn't
> break out SQL-language functions, I'm sure somebody's gonna complain.

Perhaps there was some discussion of this with Takahiro Itagaki, but I
have no recollection of having been involved in or having followed a
discussion about pg_stat_statements behavior with regards to
SQL-language functions in particular. Actually, if Itagaki-san had
discussed this, there is a reasonably good chance that I'd have read
it before now.

I can tell you that at the very least, this behavior does not seem
consistent with the documentation:

"pg_stat_statements.track controls which statements are counted by the
module. Specify top to track top-level statements (those issued
directly by clients), all to also track nested statements (such as
statements invoked within functions), or none to disable statement
statistics collection. The default value is top. Only superusers can
change this setting."

Clearly the statement "SELECT '6378168'::float8" was not directly
issued by the client here.

If this is the behavior we want for SQL functions, that is something
that ought to be highlighted as a special case.

--
Peter Geoghegan

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message rohit.guptakec 2013-08-11 08:06:55 BUG #8381: data base inconsistancy
Previous Message Tom Lane 2013-08-11 00:45:56 Re: pg_stat_statements produces multiple entries for a single query with track = 'top'