Re: pg_stat_statements_reset

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: pg_stat_statements_reset
Date: 2024-12-16 15:55:54
Message-ID: CAECtzeVW34wcE0UVRg4jCvX=aCp1DpYed_av9rhjHDHAT-fjyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message kamal deen 2024-12-16 17:12:37 Re: Postgres DB crashing in OpenSSL 3.2 Version
Previous Message Tom Lane 2024-12-16 15:47:01 Re: pg_stat_statements_reset