Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tEAzz-005gkx-Rs for pgsql-general@arkaria.postgresql.org; Thu, 21 Nov 2024 17:29:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tEAzy-00HXX1-Jz for pgsql-general@arkaria.postgresql.org; Thu, 21 Nov 2024 17:29:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tEAzy-00HXWs-83 for pgsql-general@lists.postgresql.org; Thu, 21 Nov 2024 17:29:46 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tEAzr-0035NJ-Pt for pgsql-general@postgresql.org; Thu, 21 Nov 2024 17:29:45 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-2969bf1680cso628570fac.1 for ; Thu, 21 Nov 2024 09:29:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732210179; x=1732814979; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=pudtjoiFmqz2EURcgFqPMdUf7VzWsqyBOhs2+dxtFkM=; b=C6LKqJ8xh+B9iyN28CcZWHIHy2P06U38dHwgjxNZe3G9wHYIqBhW5atQfSjPIg9Hf/ SOhaBOwYdbSTuzWDW9EiJDVhwHREMmL+SmX6nRAE34I9ex+ivOFU86D8EmnfFj8DD3YA Fgp96if3dDjSdvSfen+A3cpzHgOEgjKcltVJQaiBvno1GgUy5xDOYnkJ2boHYl4NpPgj /xOijl0hj1nsuyu8vpqXILWBvDsnwg+W//0vbG4VKj/7t/vhVJeZP1edZP1/gAMx5VTY S0dhbNs7VtiW+kXKTL3ZLLDuN5SigeT8TlWEOX2gsu99yUI10yudpdXyRsGUbuAHCJh8 947A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732210179; x=1732814979; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=pudtjoiFmqz2EURcgFqPMdUf7VzWsqyBOhs2+dxtFkM=; b=giqn5+LALsg7EjROiM1IV5VYXw8PF+DUYvyW1bWeZ7QMGE+mfLOjNf1VyPyykvomY5 KnKbCZKeDJhV+oC3Hkku+gGIc2+5+evnOBwJstZWy2bsuRlreFuLKlAUj7mA8NWt7VI5 5FJO/SQpsbj6/Gd3K2aKhI21fKqCRYr18prbFVUzOWiQfnIrrxfyED2w93nRkZWnjdMZ ETG88qlTOLEsDVXfWSaG/K1GPLYUnYKMu1FiO93llbkysheaWJz4EhRlMKsP6TELncUz gqKZw7XuBaWnmtDJLZXu+3IfRGoiKUCxHLX9UmWtN1sgp+vhJeEajYv1tBSDI9KKwgTo E54w== X-Gm-Message-State: AOJu0YwA3KCpoa7vqDHSkdAxY48QyAortmMW/GuVn2+hjswO/W5+bHcM m7RxB78rcuOYR24SWyCACqRvWChgr/iRhpfi5700gcSGvLFneKDS6IRK3JCkAdwJRkyZB+Q4NXz kUVAwiyKtBTz8VX9Ez+xXd1FoAtJXq4HW X-Gm-Gg: ASbGncupkN7hAcmPafnxZTz1t/AAsMLnCFzPee5i/81QQeBlmbe90r+msoePHqx8UUK DSa96Kg9c2xjQ9opgALFLUONCzgTawkE= X-Google-Smtp-Source: AGHT+IEmc9bBVMF00nXsfTjrJqZTJztxbTh4XKh+STU6t0u7oKijlN/mz4HSJ5mIGFKTHZ0wMmEHnPOVyqye94oxHXc= X-Received: by 2002:a05:6870:3328:b0:296:a39:4de with SMTP id 586e51a60fabf-296fcf19531mr2684529fac.21.1732210178914; Thu, 21 Nov 2024 09:29:38 -0800 (PST) MIME-Version: 1.0 From: Steeve Boulanger Date: Thu, 21 Nov 2024 11:29:26 -0600 Message-ID: Subject: Database stats ( pg_stat_database.stats_reset ) get reset on daily basis - why? To: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="00000000000064036906276f9c97" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000064036906276f9c97 Content-Type: text/plain; charset="UTF-8" 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 --00000000000064036906276f9c97 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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() - inte= rval '1 day') then 1 else null end) db_reset_cnt, count(*) db_total= _cnt from pg_stat_database;
=C2=A0db_reset_cnt | db_total_cnt
-------= -------+--------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A077 | =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0157

Furthermore, th= e archiver stats also get reset:=C2=A0

select stat= s_reset from pg_stat_archiver;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stats_= reset
-------------------------------
=C2=A02024-11-21 13:52:35.86485= 5+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
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 name =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|= setting
----------------------------+---------
=C2=A0log_min_duratio= n_statement | 0
=C2=A0log_statement =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| all
- we don't have any user procs with a = pg_stat_reset call=C2=A0
- the timestamps of the=C2=A0reset acros= s databases are sometimes close to each other, but not always
=C2= =A0
Anyone has any insight on what could be doing this daily stat= s reset, or perhaps how to find the root cause?

Regards,
S= teeve=C2=A0

--00000000000064036906276f9c97--