Re: pg_stat_statements_reset

From: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: pg_stat_statements_reset
Date: 2024-12-20 09:43:19
Message-ID: CAA5-nLDVd0i0pbVhdposfT7+FfjW4wjU6uOZBF3UHjX7L+Vo6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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 <guillaume(at)lelarge(dot)info>
wrote:

> Hello,
>
> Le lun. 16 déc. 2024 à 16:47, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> a écrit :
>
>> Fabrice Chapuis <fabrice636861(at)gmail(dot)com> 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.
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Fabrice Chapuis 2024-12-20 10:02:58 barman partial duplicate file
Previous Message Achilleas Mantzios - cloud 2024-12-20 08:32:54 Re: How To Configure PostgreSQL to Use LDAP for Authentication