Hi, On Mon, Oct 06, 2025 at 03:37:18PM +0900, Michael Paquier wrote: > On Mon, Oct 06, 2025 at 03:33:41PM +0900, Michael Paquier wrote: > > And applied this one as well after a few tweaks, mainly consistency in > > the code, with what should be the proper format bumps (thanks for the > > notes in your proposed commit message).
Thanks! > > And I forgot to mention something: now the only stats kind that does > not have a reset timestamp callback but has a SQL function able to do > resets is PGSTAT_KIND_FUNCTION. Checking for other stats kinds would have been my next step, step for doing it! > Is it worth caring about doing > something for this case as well? I think so as I don't see any reasons not to do so. PFA a patch to add stats_reset to pg_stat_user_functions. A few remakrs: - It does not use an existing macro (as such macro does not exist) to generate the function that reports this new field. So we've more flexibility for the name and went for pg_stat_get_function_stat_reset_time() (to be consistent with say pg_stat_get_db_stat_reset_time()). - The tests are done in the isolation suite (as this is where pg_stat_reset_single_function_counters() is already being tested) and I don't think there is a need to add one in the regress suite (that test for the pg_stat_user_functions output). Indeed the pg_stat_get_function_stat_reset_time() call output test is already added in the isolation one. - The new field is not added in pg_stat_xact_user_functions for the exact same reasons as it was not added for the relations case. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
>From 517f400ad25cf44c68d77d6d78e46e59d40741b4 Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot <[email protected]> Date: Mon, 6 Oct 2025 07:14:24 +0000 Subject: [PATCH v1] Add stats_reset to pg_stat_user_functions It is possible to call pg_stat_reset_single_function_counters() on a function but the reset time was missing from pg_stat_user_functions the system view showing its statistics. This commit adds the reset time as an attribute of pg_stat_user_functions. Bump catalog version. Bump PGSTAT_FILE_FORMAT_ID, as a result of the new field added to PgStat_StatFuncEntry. --- doc/src/sgml/monitoring.sgml | 9 + src/backend/catalog/system_views.sql | 3 +- src/backend/utils/activity/pgstat.c | 1 + src/backend/utils/activity/pgstat_function.c | 6 + src/backend/utils/adt/pgstatfuncs.c | 18 + src/include/catalog/pg_proc.dat | 4 + src/include/pgstat.h | 1 + src/include/utils/pgstat_internal.h | 1 + src/test/isolation/expected/stats.out | 540 ++++++++++--------- src/test/isolation/specs/stats.spec | 6 +- src/test/regress/expected/rules.out | 3 +- 11 files changed, 348 insertions(+), 244 deletions(-) 4.1% src/backend/utils/ 87.1% src/test/isolation/expected/ 6.7% src/ diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 786aa2ac5f6..10f72593fd5 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -4736,6 +4736,15 @@ description | Waiting for a newly initialized WAL file to reach durable storage other functions called by it, in milliseconds </para></entry> </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>stats_reset</structfield> <type>timestamp with time zone</type> + </para> + <para> + Time at which these statistics were last reset + </para></entry> + </row> </tbody> </tgroup> </table> diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 884b6a23817..c94f1f05f52 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -1131,7 +1131,8 @@ CREATE VIEW pg_stat_user_functions AS P.proname AS funcname, pg_stat_get_function_calls(P.oid) AS calls, pg_stat_get_function_total_time(P.oid) AS total_time, - pg_stat_get_function_self_time(P.oid) AS self_time + pg_stat_get_function_self_time(P.oid) AS self_time, + pg_stat_get_function_stat_reset_time(P.oid) AS stats_reset FROM pg_proc P LEFT JOIN pg_namespace N ON (N.oid = P.pronamespace) WHERE P.prolang != 12 -- fast check to eliminate built-in functions AND pg_stat_get_function_calls(P.oid) IS NOT NULL; diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c index 48f57e408e1..7ef06150df7 100644 --- a/src/backend/utils/activity/pgstat.c +++ b/src/backend/utils/activity/pgstat.c @@ -328,6 +328,7 @@ static const PgStat_KindInfo pgstat_kind_builtin_infos[PGSTAT_KIND_BUILTIN_SIZE] .pending_size = sizeof(PgStat_FunctionCounts), .flush_pending_cb = pgstat_function_flush_cb, + .reset_timestamp_cb = pgstat_function_reset_timestamp_cb, }, [PGSTAT_KIND_REPLSLOT] = { diff --git a/src/backend/utils/activity/pgstat_function.c b/src/backend/utils/activity/pgstat_function.c index 6214f93d36e..b5db9d15e07 100644 --- a/src/backend/utils/activity/pgstat_function.c +++ b/src/backend/utils/activity/pgstat_function.c @@ -214,6 +214,12 @@ pgstat_function_flush_cb(PgStat_EntryRef *entry_ref, bool nowait) return true; } +void +pgstat_function_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts) +{ + ((PgStatShared_Function *) header)->stats.stat_reset_timestamp = ts; +} + /* * find any existing PgStat_FunctionCounts entry for specified function * diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index 7e89a8048d5..3802a4cb888 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -203,6 +203,24 @@ PG_STAT_GET_FUNCENTRY_FLOAT8_MS(total_time) /* pg_stat_get_function_self_time */ PG_STAT_GET_FUNCENTRY_FLOAT8_MS(self_time) +Datum +pg_stat_get_function_stat_reset_time(PG_FUNCTION_ARGS) +{ + Oid funcid = PG_GETARG_OID(0); + TimestampTz result; + PgStat_StatFuncEntry *funcentry; + + if ((funcentry = pgstat_fetch_stat_funcentry(funcid)) == NULL) + result = 0; + else + result = funcentry->stat_reset_timestamp; + + if (result == 0) + PG_RETURN_NULL(); + else + PG_RETURN_TIMESTAMPTZ(result); +} + Datum pg_stat_get_backend_idset(PG_FUNCTION_ARGS) { diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index 5d5a9483fec..d4482318d41 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -6071,6 +6071,10 @@ proname => 'pg_stat_get_function_self_time', provolatile => 's', proparallel => 'r', prorettype => 'float8', proargtypes => 'oid', prosrc => 'pg_stat_get_function_self_time' }, +{ oid => '8745', descr => 'statistics: last reset for a function', + proname => 'pg_stat_get_function_stat_reset_time', provolatile => 's', + proparallel => 'r', prorettype => 'timestamptz', proargtypes => 'oid', + prosrc => 'pg_stat_get_function_stat_reset_time' }, { oid => '3037', descr => 'statistics: number of scans done for table/index in current transaction', diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 8e8adb01176..eab131e4f18 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -384,6 +384,7 @@ typedef struct PgStat_StatFuncEntry PgStat_Counter total_time; /* times in microseconds */ PgStat_Counter self_time; + TimestampTz stat_reset_timestamp; } PgStat_StatFuncEntry; typedef struct PgStat_StatReplSlotEntry diff --git a/src/include/utils/pgstat_internal.h b/src/include/utils/pgstat_internal.h index dc42d8043b5..4d2b8aa6081 100644 --- a/src/include/utils/pgstat_internal.h +++ b/src/include/utils/pgstat_internal.h @@ -691,6 +691,7 @@ extern void pgstat_database_reset_timestamp_cb(PgStatShared_Common *header, Time */ extern bool pgstat_function_flush_cb(PgStat_EntryRef *entry_ref, bool nowait); +extern void pgstat_function_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts); /* diff --git a/src/test/isolation/expected/stats.out b/src/test/isolation/expected/stats.out index 8c7fe60217e..8605247bb39 100644 --- a/src/test/isolation/expected/stats.out +++ b/src/test/isolation/expected/stats.out @@ -12,13 +12,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s1_func_call: SELECT test_stat_func(); @@ -44,13 +45,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) @@ -66,13 +68,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s1_func_call: SELECT test_stat_func(); @@ -98,13 +101,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 2|t |t |f (1 row) @@ -121,13 +125,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -191,13 +196,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 5|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 5|t |t |f (1 row) step s2_func_stats: @@ -228,13 +234,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -286,13 +293,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 3|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 3|t |t |f (1 row) step s2_func_stats: @@ -323,13 +331,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -371,13 +380,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 2|t |t |f (1 row) step s2_func_stats: @@ -408,13 +418,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -483,13 +494,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -520,13 +532,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -595,13 +608,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 3|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 3|t |t |f (1 row) step s2_func_stats: @@ -652,13 +666,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_commit: COMMIT; @@ -673,13 +688,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -718,13 +734,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_commit: COMMIT; @@ -739,13 +756,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -803,13 +821,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -859,13 +878,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) step s1_func_drop: DROP FUNCTION test_stat_func(); @@ -875,13 +895,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_call_ifexists: SELECT test_stat_func_ifexists(); @@ -902,13 +923,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -958,13 +980,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) step s1_func_drop: DROP FUNCTION test_stat_func(); @@ -974,13 +997,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_call_ifexists: SELECT test_stat_func_ifexists(); @@ -1001,13 +1025,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_func_stats: @@ -1068,13 +1093,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 2|t |t |f (1 row) step s2_func_call: SELECT test_stat_func() @@ -1100,13 +1126,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 3|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 3|t |t |f (1 row) step s1_func_stats2: @@ -1114,13 +1141,14 @@ step s1_func_stats2: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func2' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ----------------+--------------------------+----------------+--------------- -test_stat_func2| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +---------------+--------------------------+----------------+---------------+--------------- +test_stat_func2| 2|t |t |f (1 row) step s1_func_stats: @@ -1128,13 +1156,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 3|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 3|t |t |f (1 row) step s1_func_stats_reset: SELECT pg_stat_reset_single_function_counters('test_stat_func'::regproc); @@ -1148,13 +1177,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 0|f |f +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 0|f |f |t (1 row) step s1_func_stats2: @@ -1162,13 +1192,14 @@ step s1_func_stats2: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func2' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ----------------+--------------------------+----------------+--------------- -test_stat_func2| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +---------------+--------------------------+----------------+---------------+--------------- +test_stat_func2| 2|t |t |f (1 row) step s1_func_stats: @@ -1176,13 +1207,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 0|f |f +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 0|f |f |t (1 row) @@ -1258,13 +1290,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 2|t |t |f (1 row) step s1_func_stats2: @@ -1272,13 +1305,14 @@ step s1_func_stats2: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func2' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ----------------+--------------------------+----------------+--------------- -test_stat_func2| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +---------------+--------------------------+----------------+---------------+--------------- +test_stat_func2| 1|t |t |f (1 row) step s1_func_stats: @@ -1286,13 +1320,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 2|t |t |f (1 row) step s1_reset: SELECT pg_stat_reset(); @@ -1306,13 +1341,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 0|f |f +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 0|f |f |t (1 row) step s1_func_stats2: @@ -1320,13 +1356,14 @@ step s1_func_stats2: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func2' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ----------------+--------------------------+----------------+--------------- -test_stat_func2| 0|f |f +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +---------------+--------------------------+----------------+---------------+--------------- +test_stat_func2| 0|f |f |t (1 row) step s1_func_stats: @@ -1334,13 +1371,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 0|f |f +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 0|f |f |t (1 row) @@ -1369,13 +1407,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) @@ -1404,13 +1443,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) @@ -1439,13 +1479,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) @@ -1476,13 +1517,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) step s2_func_call: SELECT test_stat_func() @@ -1502,13 +1544,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 2|t |t |f (1 row) step s1_commit: COMMIT; @@ -1546,13 +1589,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) step s2_func_call: SELECT test_stat_func() @@ -1578,13 +1622,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) step s1_func_stats2: @@ -1592,13 +1637,14 @@ step s1_func_stats2: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func2' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ----------------+--------------------------+----------------+--------------- -test_stat_func2| 2|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +---------------+--------------------------+----------------+---------------+--------------- +test_stat_func2| 2|t |t |f (1 row) step s1_commit: COMMIT; @@ -1636,13 +1682,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) step s2_func_call: SELECT test_stat_func() @@ -1668,13 +1715,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) step s1_func_stats2: @@ -1682,13 +1730,14 @@ step s1_func_stats2: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func2' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ----------------+--------------------------+----------------+--------------- -test_stat_func2| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +---------------+--------------------------+----------------+---------------+--------------- +test_stat_func2| 1|t |t |f (1 row) step s1_commit: COMMIT; @@ -1835,13 +1884,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 5|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 5|t |t |f (1 row) step s1_commit_prepared_a: COMMIT PREPARED 'a'; @@ -1850,13 +1900,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) @@ -1924,13 +1975,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 5|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 5|t |t |f (1 row) step s1_rollback_prepared_a: ROLLBACK PREPARED 'a'; @@ -1939,13 +1991,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 5|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 5|t |t |f (1 row) @@ -2013,13 +2066,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 5|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 5|t |t |f (1 row) step s2_commit_prepared_a: COMMIT PREPARED 'a'; @@ -2028,13 +2082,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) @@ -2102,13 +2157,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 5|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 5|t |t |f (1 row) step s2_rollback_prepared_a: ROLLBACK PREPARED 'a'; @@ -2117,13 +2173,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 5|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 5|t |t |f (1 row) @@ -3606,13 +3663,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s2_big_notify: SELECT pg_notify('stats_test_use', @@ -3703,13 +3761,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| | | +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| | | |f (1 row) step s1_clear_snapshot: SELECT pg_stat_clear_snapshot(); @@ -3723,13 +3782,14 @@ step s1_func_stats: tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' -name |pg_stat_get_function_calls|total_above_zero|self_above_zero ---------------+--------------------------+----------------+--------------- -test_stat_func| 1|t |t +name |pg_stat_get_function_calls|total_above_zero|self_above_zero|has_stats_reset +--------------+--------------------------+----------------+---------------+--------------- +test_stat_func| 1|t |t |f (1 row) step s1_commit: COMMIT; diff --git a/src/test/isolation/specs/stats.spec b/src/test/isolation/specs/stats.spec index e6d29749915..5956ee093f6 100644 --- a/src/test/isolation/specs/stats.spec +++ b/src/test/isolation/specs/stats.spec @@ -65,7 +65,8 @@ step s1_func_stats { tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func' } @@ -74,7 +75,8 @@ step s1_func_stats2 { tso.name, pg_stat_get_function_calls(tso.oid), pg_stat_get_function_total_time(tso.oid) > 0 total_above_zero, - pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero + pg_stat_get_function_self_time(tso.oid) > 0 self_above_zero, + pg_stat_get_function_stat_reset_time(tso.oid) IS NOT NULL has_stats_reset FROM test_stat_oid AS tso WHERE tso.name = 'test_stat_func2' } diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 7f1cb3bb4af..8859a5a885f 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -2244,7 +2244,8 @@ pg_stat_user_functions| SELECT p.oid AS funcid, p.proname AS funcname, pg_stat_get_function_calls(p.oid) AS calls, pg_stat_get_function_total_time(p.oid) AS total_time, - pg_stat_get_function_self_time(p.oid) AS self_time + pg_stat_get_function_self_time(p.oid) AS self_time, + pg_stat_get_function_stat_reset_time(p.oid) AS stats_reset FROM (pg_proc p LEFT JOIN pg_namespace n ON ((n.oid = p.pronamespace))) WHERE ((p.prolang <> (12)::oid) AND (pg_stat_get_function_calls(p.oid) IS NOT NULL)); -- 2.34.1
