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

Thanks for your explanations Tom, Guillaume, your solution works fine for
me too.

Regards

Fabrice

On Mon, Dec 16, 2024 at 4:56 PM Guillaume Lelarge <[email protected]>
wrote:

> 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)

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: <CAA5-nLDVd0i0pbVhdposfT7+FfjW4wjU6uOZBF3UHjX7L+Vo6w@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