X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A0AB52AA9 for ; Wed, 2 Mar 2005 00:58:17 +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 56496-07 for ; Wed, 2 Mar 2005 00:58:09 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7A61B52A65 for ; Wed, 2 Mar 2005 00:58:08 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id DCC8632065; Wed, 2 Mar 2005 01:58:11 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: Inheritence versus delete from Date: Wed, 02 Mar 2005 01:56:52 +0100 Organization: Hub.Org Networking Services Lines: 32 Message-ID: <42250F54.8060508@bigfoot.com> References: <1109635153.4620.44.camel@lanshark.dmv.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Sven Willenberger User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <1109635153.4620.44.camel@lanshark.dmv.com> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/17 X-Sequence-Number: 10722 Sven Willenberger wrote: > Trying to determine the best overall approach for the following > scenario: > > Each month our primary table accumulates some 30 million rows (which > could very well hit 60+ million rows per month by year's end). Basically > there will end up being a lot of historical data with little value > beyond archival. > > The question arises then as the best approach of which I have enumerated > three: > > 1) Just allow the records to accumulate and maintain constant vacuuming, > etc allowing for the fact that most queries will only be from a recent > subset of data and should be mostly cached. > > 2) Each month: > SELECT * INTO 3monthsago_dynamically_named_table FROM bigtable WHERE > targetdate < $3monthsago; > DELETE FROM bigtable where targetdate < $3monthsago; > VACUUM ANALYZE bigtable; > pg_dump 3monthsago_dynamically_named_table for archiving; In my experience copy/delete in a single transaction 60+ million rows is not feseable, at least on my 1 GB ram, 2 way CPU box. Regards Gaetano Mendola