Re: unreliable behaviour of track_functions
I mean this part describing track_function: https://www.postgresql.org/docs/10/static/runtime-config-statistics.html Enables tracking of function call counts and time used. Specify pl to track only procedural-language functions, all to also track SQL and C language functions. The default is none, which disables function statistics tracking. Only superusers can change this setting. Note SQL-language functions that are simple enough to be “inlined” into the calling query will not be tracked, regardless of this setting. Only case described here, that exclude function from being tracked it's inlining, not the time and not the place in the query. So I would expect that pg_stat_user_function will show me that my function was executed. Good that are other ways to do it, but changing track_functions to 'all' I would expect all calls will be tracked... -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
Re: unreliable behaviour of track_functions
I mean this part describing track_function: https://www.postgresql.org/docs/10/static/runtime-config-statistics.html Enables tracking of function call counts and time used. Specify pl to track only procedural-language functions, all to also track SQL and C language functions. The default is none, which disables function statistics tracking. Only superusers can change this setting. Note SQL-language functions that are simple enough to be “inlined” into the calling query will not be tracked, regardless of this setting. Only case described here, that exclude function from being tracked it's inlining, not the time and not the place in the query. So I would expect that pg_stat_user_function will show me that my function was executed. Good that are other ways to do it, but changing track_functions to 'all' I would expect all calls will be tracked... -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
Re: unreliable behaviour of track_functions
and to be clear I was experimenting with pg_stat_clear_snapshot() after your answer, but it doesn't change behaviour of track_functions. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
Re: Please suggest the best suited unit test frame work for postgresql database.
On 03/31/2018 09:56 PM, Raghavendra Rao J S V wrote: Good morning. Please suggest the best suited unit test frame work for postgresql database and also shared the related documents to understand the framework. If you are looking for a Postgres specific framework then see pgTap: http://pgtap.org/ -- Regards, Raghavendra Rao J S V -- Adrian Klaver adrian.kla...@aklaver.com
Re: unreliable behaviour of track_functions
On 04/01/2018 06:02 AM, pinker wrote: I mean this part describing track_function: https://www.postgresql.org/docs/10/static/runtime-config-statistics.html Enables tracking of function call counts and time used. Specify pl to track only procedural-language functions, all to also track SQL and C language functions. The default is none, which disables function statistics tracking. Only superusers can change this setting. Note SQL-language functions that are simple enough to be “inlined” into the calling query will not be tracked, regardless of this setting. Only case described here, that exclude function from being tracked it's inlining, not the time and not the place in the query. The below might help: https://wiki.postgresql.org/wiki/Inlining_of_SQL_functions In particular for your second case(place in query): " Table functions A table function call is any instance where func(args) appears where a table is expected. (This is, for most functions, a PostgreSQL extension to the SQL standard.) For example: select * from func(123); " For your first case: Inlining conditions for scalar functions "the function body consists of a single, simple, SELECT expression" So from your OP: CREATE FUNCTION a(a bigint) RETURNS bigint STABLE LANGUAGE SQL AS $$ SELECT $1 $$; If you change to: CREATE FUNCTION a(a bigint) RETURNS bigint STABLE LANGUAGE SQL AS $$ SELECT 'test'; SELECT $1 $$; then before change: test=> select * from pg_stat_user_functions ; funcid | schemaname | funcname | calls | total_time | self_time -++--+---++--- 1386647 | public | a| 2 | 1251.598 | 1251.598 (1 row) after change: test=> select * from pg_stat_user_functions ; funcid | schemaname | funcname | calls | total_time | self_time -++--+---++--- 1386647 | public | a| 3 | 1251.682 | 1251.682 So I would expect that pg_stat_user_function will show me that my function was executed. Good that are other ways to do it, but changing track_functions to 'all' I would expect all calls will be tracked... -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html -- Adrian Klaver adrian.kla...@aklaver.com