X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 914BB3A56D0 for ; Thu, 2 Dec 2004 02:15:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49583-05 for ; Thu, 2 Dec 2004 02:15:26 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id D47E13A5694 for ; Thu, 2 Dec 2004 02:15:02 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by www.postgresql.com (Postfix) with ESMTP id 7EC74738DB7 for ; Wed, 1 Dec 2004 20:11:08 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id iB1K9fGP022401 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 1 Dec 2004 13:09:43 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id iB1K9eYE025212; Wed, 1 Dec 2004 13:09:40 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id iB1K9eke025211; Wed, 1 Dec 2004 13:09:40 -0700 (MST) (envelope-from mfuhr) Date: Wed, 1 Dec 2004 13:09:40 -0700 From: Michael Fuhr To: Yudie Cc: pgsql-sql@postgresql.org Subject: Re: Found Large Files.. what objects are they? Message-ID: <20041201200940.GA24852@winnie.fuhr.org> References: <002201c4d7d0$9af23330$a101a8c0@home.axiontech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002201c4d7d0$9af23330$a101a8c0@home.axiontech.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200412/16 X-Sequence-Number: 19636 On Wed, Dec 01, 2004 at 12:07:20PM -0600, Yudie wrote: > I found bunch of large files (more than 1 gb) in one of database directory. > The files looks like this: > 69233123 > 69233123.1 > 69233123.2 > 69233123.3 > 69233123.4 > ...and so on. > > These large files very delay the dumping process. > Anyone know what it could be & how to delete the object related? When a file exceeds 1GB, PostgreSQL divides it into segments named N, N.1, N.2, etc. > How to find a table by oid? contrib/oid2name should be helpful. You could also query the system catalogs: the files' parent directory should be the database's OID, so for a file named .../12345/69233123 you could identify the database with the following query: SELECT datname FROM pg_database WHERE oid = 12345; Connect to that database and find out which table or index uses the files: SELECT relname FROM pg_class WHERE relfilenode = 69233123; Once you've done that, figure out why the files are so large: Could it simply be that the table stores a lot of data? Have you been running VACUUM? If not, and if you've made a lot of updates or deletes, then you'll have a lot of dead tuples; contrib/pgstattuple can be useful for checking on that. If that's the case, then VACUUM FULL and/or REINDEX should recover the dead space, but be aware that they'll acquire exclusive locks on the objects they're working with and they might take a long time (hours) to run. Also, after a REINDEX a table's indexes will probably be stored in different files; you can find out the new file names by querying pg_class and looking at the relfilenode field. Another possibility would be to dump, drop, recreate, and restore the table and see if the file sizes shrink. Again, the file names will probably change, so query pg_class to see what the new ones are. -- Michael Fuhr http://www.fuhr.org/~mfuhr/