Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EE04637BE34 for ; Wed, 8 Oct 2008 10:17:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 33271-04 for ; Wed, 8 Oct 2008 10:17:01 -0300 (ADT) 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 postgresql.org (Postfix) with ESMTP id 0CDC837BAB6 for ; Wed, 8 Oct 2008 10:17:01 -0300 (ADT) 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 m98DGoEQ027957; Wed, 8 Oct 2008 09:16:50 -0400 (EDT) To: Matthew Wakeling cc: pgsql-performance@postgresql.org Subject: Re: Disc space usage In-reply-to: References: Comments: In-reply-to Matthew Wakeling message dated "Wed, 08 Oct 2008 12:55:52 +0100" Date: Wed, 08 Oct 2008 09:16:50 -0400 Message-ID: <27956.1223471810@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200810/33 X-Sequence-Number: 31614 Matthew Wakeling writes: > One of our build servers recently ran out of disc space while trying to > copy an entire database. This led me to investigate the database cluster, > which is stored on a RAID array with a total size of 1TB. Running a query > to list all databases and their sizes did not add up to the amount of > space being used by Postgres, so I had a look at the pgsql/base directory. > It appears that there are a few large directories that do not correspond > to any database. I wonder if these have been left behind accidentally by > Postgres. Anything under $PGDATA/base that doesn't correspond to a live row in pg_database is junk. The interesting question is how it got that way, and in particular how you seem to have managed to have repeated instances of it. I gather that you're in the habit of using CREATE DATABASE to copy large existing databases, so the most likely theory is that these are leftovers from previous failed copy attempts. Now CREATE DATABASE does attempt to clean up if its copying fails, but there are various ways to break that, for instance hitting control-C partway through the cleanup phase. So I'm wondering if maybe that's been done a few times. What PG version is this, anyway? regards, tom lane