Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 41D8B9FBCE0 for ; Wed, 21 Feb 2007 14:03:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 09390-02-2 for ; Wed, 21 Feb 2007 14:02:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id CECBF9FBD60 for ; Wed, 21 Feb 2007 14:02:55 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 1171B308F7; Wed, 21 Feb 2007 19:02:55 +0100 (MET) From: Mark Stosberg X-Newsgroups: pgsql.performance Subject: How to avoid vacuuming a huge logging table Date: Wed, 21 Feb 2007 13:02:16 -0500 Organization: Hub.Org Networking Services Lines: 30 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5.0.8 (X11/20061109) To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.229 tagged_above=0 required=5 tests=AWL, BAYES_50 X-Spam-Level: X-Archive-Number: 200702/213 X-Sequence-Number: 23267 Our application has a table that is only logged to, and infrequently used for reporting. There generally no deletes and updates. Recently, the shear size (an estimated 36 million rows) caused a serious problem because it prevented a "vacuum analyze" on the whole database from finishing in a timely manner. As I understand, a table with this usage pattern wouldn't need to be vacuumed anyway. I'm looking for general advice from people who have faced the same issue. I'm looking at a number of alternatives: 1. Once a month, we could delete and archive old rows, for possible re-import later if we need to report on them. It would seem this would need to be done as proper insert statements for re-importing. (Maybe there is a solution for that with table partitioning? ) 2. We could find a way to exclude the table for vacuuming, and let it grow even larger. Putting the table in it's own database would accomplish that, but it would nice to avoid the overhead of a second database connection. 3. Take a really different approach. Log in CSV format to text files instead, And only import the date ranges we need "on demand" if a report is requested on the data. Thanks for any tips. Mark