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 354A2564AC for ; Tue, 1 Mar 2005 01:07:33 +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 16037-10 for ; Tue, 1 Mar 2005 01:07:24 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AD0D556498 for ; Tue, 1 Mar 2005 01:07:23 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j2117KYL011428; Mon, 28 Feb 2005 20:07:20 -0500 (EST) To: Sven Willenberger Cc: Postgresql Performance list Subject: Re: Inheritence versus delete from In-reply-to: <1109635153.4620.44.camel@lanshark.dmv.com> References: <1109635153.4620.44.camel@lanshark.dmv.com> Comments: In-reply-to Sven Willenberger message dated "Mon, 28 Feb 2005 18:59:13 -0500" Date: Mon, 28 Feb 2005 20:07:20 -0500 Message-ID: <11427.1109639240@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/1 X-Sequence-Number: 10706 Sven Willenberger writes: > 3) Each month: > CREATE newmonth_dynamically_named_table (like mastertable) INHERITS > (mastertable); > modify the copy.sql script to copy newmonth_dynamically_named_table; > pg_dump 3monthsago_dynamically_named_table for archiving; > drop table 3monthsago_dynamically_named_table; A number of people use the above approach. It's got some limitations, mainly that the planner isn't super bright about what you are doing --- in particular, joins involving such a table may work slowly. On the whole I'd probably go with the other approach (one big table). A possible win is to use CLUSTER rather than VACUUM ANALYZE to recover space after your big deletes; however this assumes that you can schedule downtime to do the CLUSTERs in. regards, tom lane