Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kIrg9-00085a-7z for pgsql-bugs@arkaria.postgresql.org; Thu, 17 Sep 2020 11:02:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kIrg6-0004HV-Rv for pgsql-bugs@arkaria.postgresql.org; Thu, 17 Sep 2020 11:02:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kIrg6-0004HO-MR for pgsql-bugs@lists.postgresql.org; Thu, 17 Sep 2020 11:02:14 +0000 Received: from smtp-zimbra.meteo.fr ([137.129.16.22] helo=celebrian1.meteo.fr) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kIrg3-0001qG-W1 for pgsql-bugs@lists.postgresql.org; Thu, 17 Sep 2020 11:02:14 +0000 Received: from localhost (localhost [127.0.0.1]) by celebrian1.meteo.fr (Postfix) with ESMTP id 253871C2267; Thu, 17 Sep 2020 13:02:10 +0200 (CEST) Received: from celebrian1.meteo.fr ([127.0.0.1]) by localhost (celebrian1.meteo.fr [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 50Bouheu1MkN; Thu, 17 Sep 2020 13:02:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by celebrian1.meteo.fr (Postfix) with ESMTP id 094541C226F; Thu, 17 Sep 2020 13:02:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at celebrian1.meteo.fr Received: from celebrian1.meteo.fr ([127.0.0.1]) by localhost (celebrian1.meteo.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3RjvAKSetHiY; Thu, 17 Sep 2020 13:02:09 +0200 (CEST) Received: from zumba2.meteo.fr (zumba2 [172.31.9.198]) by celebrian1.meteo.fr (Postfix) with ESMTP id E58D41C2267; Thu, 17 Sep 2020 13:02:09 +0200 (CEST) Date: Thu, 17 Sep 2020 13:02:09 +0200 (CEST) From: =?utf-8?Q?RECHT=C3=89?= Marc To: Jehan-Guillaume de Rorthais Cc: pgsql-bugs@lists.postgresql.org Message-ID: <774919352.9027167.1600340529424.JavaMail.zimbra@meteo.fr> In-Reply-To: <20200917093944.528c26a3@firost> References: <721986302.8509039.1600268805471.JavaMail.zimbra@meteo.fr> <20200916173124.297baa41@firost> <746448376.8762238.1600324690698.JavaMail.zimbra@meteo.fr> <20200917093944.528c26a3@firost> Subject: Re: Inconsitancies in pg_stat_bgwriter and pg_stat_database returned values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.31.9.205] X-Mailer: Zimbra 8.7.11_GA_3822 (ZimbraWebClient - FF80 (Linux)/8.7.11_GA_3822) Thread-Topic: Inconsitancies in pg_stat_bgwriter and pg_stat_database returned values Thread-Index: cBgpKeM31LUYLOafbfbqXQqDw/OuFQ== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ----- Mail original ----- De: "Jehan-Guillaume de Rorthais" =C3=80: "RECHT=C3=89 Marc" Cc: pgsql-bugs@lists.postgresql.org Envoy=C3=A9: Jeudi 17 Septembre 2020 09:39:44 Objet: Re: Inconsitancies in pg_stat_bgwriter and pg_stat_database returned= values On Thu, 17 Sep 2020 08:38:10 +0200 (CEST) RECHT=C3=89 Marc wrote: [...] > The full row are different in your example, not just a few fields. It loo= ks > like mixed values from different instance. >=20 > Could you share some more informations about the context and how to repro= duce > it? >=20 > Regards, >=20 > Hello=20 >=20 > Thanks a lot, you got it right: there are 2 instances on this machine and > they are both configured with: >=20 > stats_temp_directory =3D '/dev/shm' >=20 > We some time ago tried, stats_temp_directory =3D '/dev/shm/instance', but > PostgreSQL ignored the subdirectory part and kept creating the temp file = at > the FS root. As this is a temporary FS, one cannot in advance create the > instance subdirectory as it is wiped out between reboots. Use "/var/run/postgresql/instance_name" and setup systemd tmpfiles to creat= e the folder automatically. Eg.: cat < /etc/tmpfiles.d/postgresql-stats.conf # Directory for PostgreSQL temp stat files d /var/run/postgresql/stats-instance_name 0700 postgres postgres - - EOF You can add as many folders as you need. To take this file in consideration immediately without rebooting the server= , run the following command: systemd-tmpfiles --create /etc/tmpfiles.d/postgresql-stats.conf Regards, I applied your suggestions. Thanks again. Marc.