public inbox for [email protected]  
help / color / mirror / Atom feed
From: Guillaume Lelarge <[email protected]>
To: Tom Lane <[email protected]>
Cc: Fabrice Chapuis <[email protected]>
Cc: [email protected]
Subject: Re: pg_stat_statements_reset
Date: Mon, 16 Dec 2024 16:55:54 +0100
Message-ID: <CAECtzeVW34wcE0UVRg4jCvX=aCp1DpYed_av9rhjHDHAT-fjyQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAA5-nLDgGReN_C9TYsuSC4X04xzGdFbM=V3CsBo2J0xePceOaQ@mail.gmail.com>
	<[email protected]>

Hello,

Le lun. 16 déc. 2024 à 16:47, Tom Lane <[email protected]> a écrit :

> Fabrice Chapuis <[email protected]> writes:
> > This query seems not resetting stats for databae mydb
>
> > SELECT pg_stat_statements_reset(
> >     NULL,  -- userid: NULL means "all users"
> >     (SELECT oid FROM pg_database WHERE datname = 'mydb'),
> >     NULL   -- queryid: NULL means "all queries"
> > );
>
> Where did you get the idea that NULL means "all"?  AFAICS
> that function is strict, meaning it won't run at all for
> null input.
>
>
You should try:

select pg_stat_statements_reset(dbid => oid)
from pg_database
where datname='mydb';

Works on my test case (and I find it easier to understand, but that may be
subjective).


-- 
Guillaume.


view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pg_stat_statements_reset
  In-Reply-To: <CAECtzeVW34wcE0UVRg4jCvX=aCp1DpYed_av9rhjHDHAT-fjyQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox