Обсуждение: some broken on pg_stat_user_functions
Hello I am checking this functionality and I am afraid, so option all is broken. postgres=# select * from pg_stat_user_functions; funcid | schemaname | funcname | calls | total_time | self_time --------+------------+----------+-------+------------+----------- 24608 | public | test | 6 | 2002 | 2002 (1 row) postgres=# create or replace function test(i integer) returns int as $$begin perform pg_sleep(1);return i; end;$$ language plpgsql; CREATE FUNCTION postgres=# create or replace function test1(i integer) returns int as $$ select $1; $$ language sql; CREATE FUNCTION postgres=# select test(10);test ------ 10 (1 row) postgres=# select test1(10);test1 ------- 10 (1 row) postgres=# set track_functions to 'all'; SET postgres=# select test1(10);test1 ------- 10 (1 row) postgres=# select test(10);test ------ 10 (1 row) postgres=# select * from pg_stat_user_functions; funcid | schemaname | funcname | calls | total_time | self_time --------+------------+----------+-------+------------+----------- 24608 | public | test | 8 | 4003 | 4003 (1 row) I don't see call test1 :( regards Pavel Stehule
Pavel Stehule <pavel.stehule@gmail.com> writes:
> postgres=# create or replace function test1(i integer) returns int as
> $$ select $1; $$ language sql;
This function will get inlined, so there's no separate entity to track
the execution of.
regards, tom lane
2009/2/22 Tom Lane <tgl@sss.pgh.pa.us>: > Pavel Stehule <pavel.stehule@gmail.com> writes: >> postgres=# create or replace function test1(i integer) returns int as >> $$ select $1; $$ language sql; > > This function will get inlined, so there's no separate entity to track > the execution of. > then documentation is probably little bit wrong (needs some additional comment) . This text specifies using option 'all' for sql functions. regards Pavel Stehule > regards, tom lane >
Pavel Stehule wrote:
> then documentation is probably little bit wrong (needs some additional
> comment) . This text specifies using option 'all' for sql functions.
>
Attached documentation patch attempts to clarify this.
regards,
Martin
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 5cc395e..b7c34c3 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -3363,7 +3363,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
Enables tracking of function call counts and time used. Specify
<literal>pl</literal> to count only procedural language functions,
<literal>all</literal> to also track SQL and C language functions.
- The default is <literal>none</literal>.
+ The default is <literal>none</literal>. Note that inlined SQL
+ functions are not tracked, regardless of the parameter value.
Only superusers can change this setting.
</para>
</listitem>
2009/2/22 Martin Pihlak <martin.pihlak@gmail.com>: > Pavel Stehule wrote: >> then documentation is probably little bit wrong (needs some additional >> comment) . This text specifies using option 'all' for sql functions. >> > > Attached documentation patch attempts to clarify this. > > regards, > Martin > > thank you Pavel
Martin Pihlak <martin.pihlak@gmail.com> writes:
> Attached documentation patch attempts to clarify this.
Applied in a slightly modified form.
regards, tom lane