public inbox for [email protected]  
help / color / mirror / Atom feed
From: Steeve Boulanger <[email protected]>
To: [email protected]
Subject: Database stats ( pg_stat_database.stats_reset ) get reset on daily basis - why?
Date: Thu, 21 Nov 2024 11:29:26 -0600
Message-ID: <CAAiSvx8_Z6QGey92dC+6Yona18KDMLWinfR5LOJsMgj-42XJtg@mail.gmail.com> (raw)

Hello,

I have noticed recently that our databases (ie most but not all) have their
stats reset on daily basis:

select count(case when stats_reset > (now() - interval '1 day') then 1 else
null end) db_reset_cnt, count(*) db_total_cnt from pg_stat_database;
 db_reset_cnt | db_total_cnt
--------------+--------------
           77 |          157

Furthermore, the archiver stats also get reset:

select stats_reset from pg_stat_archiver;
          stats_reset
-------------------------------
 2024-11-21 13:52:35.864855+00

Some facts:
- PostgreSQL v13.16 on Linux Ubuntu 20.04
- There's no evidence in the logs that any pg_stat_reset* functions have
been executed
            name            | setting
----------------------------+---------
 log_min_duration_statement | 0
 log_statement              | all
- we don't have any user procs with a pg_stat_reset call
- the timestamps of the reset across databases are sometimes close to each
other, but not always

Anyone has any insight on what could be doing this daily stats reset, or
perhaps how to find the root cause?

Regards,
Steeve


view thread (3+ 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]
  Subject: Re: Database stats ( pg_stat_database.stats_reset ) get reset on daily basis - why?
  In-Reply-To: <CAAiSvx8_Z6QGey92dC+6Yona18KDMLWinfR5LOJsMgj-42XJtg@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