Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 07FBA1337B6C for ; Tue, 23 Nov 2010 00:12:09 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 02225-10 for ; Tue, 23 Nov 2010 04:12:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id A66281337B58 for ; Tue, 23 Nov 2010 00:12:00 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id oAN4Bxs9025743; Mon, 22 Nov 2010 23:11:59 -0500 (EST) To: Jon Nelson cc: pgsql-bugs@postgresql.org Subject: Re: temporary tables, and lots of 0 byte files In-reply-to: References: Comments: In-reply-to Jon Nelson message dated "Mon, 22 Nov 2010 21:32:50 -0600" Date: Mon, 22 Nov 2010 23:11:59 -0500 Message-ID: <25742.1290485519@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/144 X-Sequence-Number: 28724 Jon Nelson writes: > Here is the problem: When I started benchmarking this application, I > noticed it (postgresql) started chewing up inodes on the logical > volume which houses /var/lib/pgsql. It chewed up a few thousand > inodes, and then a few thousand more, and then there were no more. > I investigated /var/lib/pgsql/data/ and found within the database's > directory many thousands of 0-byte files. I stopped the application > expecting at the end of a /session/ that the inodes would be unlinked, > but there was no change. lsof told me nobody had them open. However, a > start/stop of postgresql removed (at least most of) the 0-byte files. > After some trial and error, I straced the right process (the bgwriter > process) and found that, upon signal to leave, it would write some > checkpoint-y stuff and then proceed about unlinking most or all of the > 0-byte files. This is not a bug; it's normal behavior when dropping a table. The table file is truncated to zero bytes at commit, but it's not unlinked until the next checkpoint. I surmise that you may have a very long checkpoint cycle time selected. > What can be done to remove all of the files associated with dropped > (temporary) tables _when_ the they are dropped? Nothing other than forcing a checkpoint. There are race-condition-related reasons for doing it like this, which I don't have at the top of my brain, but you can find them in the archives if you care enough. regards, tom lane