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 1oWUwZ-0001Bd-Qu for pgsql-general@arkaria.postgresql.org; Fri, 09 Sep 2022 03:44:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oWUvZ-0000ED-Rr for pgsql-general@arkaria.postgresql.org; Fri, 09 Sep 2022 03:43:37 +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 1oWUvZ-0000E0-HD for pgsql-general@lists.postgresql.org; Fri, 09 Sep 2022 03:43:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWUvW-0003fv-KX for pgsql-general@lists.postgresql.org; Fri, 09 Sep 2022 03:43:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2893goNg012703; Thu, 8 Sep 2022 23:42:50 -0400 From: Tom Lane To: Perry Smith cc: pgsql-general list Subject: Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted In-reply-to: References: Comments: In-reply-to Perry Smith message dated "Thu, 08 Sep 2022 22:05:36 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <12701.1662694970.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 08 Sep 2022 23:42:50 -0400 Message-ID: <12702.1662694970@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Perry Smith writes: > From within the container, files which I assume are created by > PostgreSQL are ending up being owned by root rather than Postgres. If it looks that way from *inside* the container, that's not good --- wouldn't that prevent Postgres from reading the files? > The reason I’m sending this note to the general list is to ask how bad > is this error? Some “solutions” are to make the pg_stat_tmp directory > internal to the image and that somehow resolves the issue but I don’t > think anyone really understands why and things like that bother me. But > I’m also curious if that appears to be a viable solution. The result > will be that when the Postgres is stopped and the container exited, the > next time Postgres starts back up, the pg_stat_tmp directory will be > gone. Is that ok? pg_stat_tmp exists specifically because it holds only temporary files, cf https://www.postgresql.org/docs/devel/storage-file-layout.html It's explicitly cleared out during server start. The only reason to put it outside the data directory is to make it *less* persistent than the rest of PG's files, say by putting it on a RAM disk. You sound like you've set it up to be *more* persistent (ie outside the container not inside), which surely is exactly backwards. regards, tom lane