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 1khDqK-0006lJ-VQ for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Nov 2020 15:33:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1khDqJ-00005S-UG for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Nov 2020 15:33:27 +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 1khDqJ-00005K-O2 for pgsql-bugs@lists.postgresql.org; Mon, 23 Nov 2020 15:33:27 +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 1khDqH-0000LN-6D for pgsql-bugs@lists.postgresql.org; Mon, 23 Nov 2020 15:33:27 +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 0ANFXLmA057260; Mon, 23 Nov 2020 10:33:21 -0500 From: Tom Lane To: manojkumar@ameyo.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16739: Temporary files not deleting from data folder on disk In-reply-to: <16739-01bbd1b6e3a30313@postgresql.org> References: <16739-01bbd1b6e3a30313@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 23 Nov 2020 08:41:07 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <57258.1606145601.1@sss.pgh.pa.us> Date: Mon, 23 Nov 2020 10:33:21 -0500 Message-ID: <57259.1606145601@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > There is a problem with Postgres that temporary tables being created are not > cleaning up by Postgres itself. Can you produce any actual evidence of that, or even better a reproduction sequence? > Count of temporary files- > select count(*) from pg_ls_dir ( '/var/lib/pgsql/10/data/base/16384' ) as > file where file::text not in (select oid::text from pg_class ); This is not evidence, because the test is completely incorrect. * OID is not the pg_class field to use. relfilenode is closer, although that will still mislead you for certain system catalogs. pg_relation_filenode(oid) is really the recommended way to get the base file name for a pg_class entry. * Even once you've got the right filename, it's only the *base* file name. There might be additional segments (nnn.1, nnn.2, etc) if any table exceeds 1GB. There are likely to also be "nnn_fsm" and "nnn_vm" subsidiary files, and maybe "nnn_init" files. All of those would have to be excluded before concluding that files are being leaked. See https://www.postgresql.org/docs/current/storage.html for more info about what you should expect to see in a database directory. regards, tom lane