pg_stat_reset_slru currently requires an input argument, either:
- NULL to reset the SLRU counters of everything.
- A specific value to reset a single SLRU cache.
This commit adds support for a new pattern: pg_stat_reset_slru without
any argument works the same way as pg_stat_reset_slru(NULL), relying on
a DEFAULT in the function definition to handle this case. This makes
the function more consistent with
23c8c0c8f472.
Bump catalog version.
Author: Bharath Rupireddy
Reviewed-by: Atsushi Torikoshi
Discussion: https://postgr.es/m/CALj2ACW1VizYg01EeH_cA-7qA+4NzWVAoZ5Lw9_XYO1RRHAZbA@mail.gmail.com
- pg_stat_reset_slru ( text )
+
pg_stat_reset_slru (
[ target text DEFAULT NULL ] )
void
Resets statistics to zero for a single SLRU cache, or for all SLRUs in
- the cluster. If the argument is NULL, all counters shown in
+ the cluster. If
target is
+ NULL or is not specified, all the counters shown in
the pg_stat_slru view for all SLRU caches are
- reset. The argument can be one of
+ reset. The argument can be one of
CommitTs,
MultiXactMember,
MultiXactOffset,
CALLED ON NULL INPUT VOLATILE PARALLEL SAFE
AS 'pg_stat_reset_shared';
+CREATE OR REPLACE FUNCTION
+ pg_stat_reset_slru(target text DEFAULT NULL)
+RETURNS void
+LANGUAGE INTERNAL
+CALLED ON NULL INPUT VOLATILE PARALLEL SAFE
+AS 'pg_stat_reset_slru';
+
--
-- The default permissions for functions mean that anyone can execute them.
-- A number of functions shouldn't be executable by just anyone, but rather
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202311121
+#define CATALOG_VERSION_NO 202311141
#endif
{ oid => '2307',
descr => 'statistics: reset collected statistics for a single SLRU',
proname => 'pg_stat_reset_slru', proisstrict => 'f', provolatile => 'v',
- prorettype => 'void', proargtypes => 'text', prosrc => 'pg_stat_reset_slru' },
+ prorettype => 'void', proargtypes => 'text', proargnames => '{target}',
+ prosrc => 'pg_stat_reset_slru' },
{ oid => '6170',
descr => 'statistics: reset collected statistics for a single replication slot',
proname => 'pg_stat_reset_replication_slot', proisstrict => 'f',
SELECT stats_reset AS slru_commit_ts_reset_ts FROM pg_stat_slru WHERE name = 'CommitTs' \gset
-- Test that multiple SLRUs are reset when no specific SLRU provided to reset function
-SELECT pg_stat_reset_slru(NULL);
+SELECT pg_stat_reset_slru();
pg_stat_reset_slru
--------------------
SELECT stats_reset AS slru_commit_ts_reset_ts FROM pg_stat_slru WHERE name = 'CommitTs' \gset
-- Test that multiple SLRUs are reset when no specific SLRU provided to reset function
-SELECT pg_stat_reset_slru(NULL);
+SELECT pg_stat_reset_slru();
SELECT stats_reset > :'slru_commit_ts_reset_ts'::timestamptz FROM pg_stat_slru WHERE name = 'CommitTs';
SELECT stats_reset > :'slru_notify_reset_ts'::timestamptz FROM pg_stat_slru WHERE name = 'Notify';