Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 1ADB09FB1CD for ; Sat, 25 Nov 2006 21:26:36 -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 58464-07 for ; Sat, 25 Nov 2006 21:26:26 -0400 (AST) X-Greylist: delayed 00:51:25.099369 by SQLgrey-1.7.4 Received: from pillette.com (adsl-67-119-5-202.dsl.snfc21.pacbell.net [67.119.5.202]) by postgresql.org (Postfix) with ESMTP id F1D559FB1CC for ; Sat, 25 Nov 2006 21:26:30 -0400 (AST) Received: (from andrew@localhost) by pillette.com (8.11.6/8.11.6) id kAQ0Z1G02487; Sat, 25 Nov 2006 16:35:01 -0800 Date: Sat, 25 Nov 2006 16:35:01 -0800 From: andrew@pillette.com Message-Id: <200611260035.kAQ0Z1G02487@pillette.com> Subject: Re: Massive delete of rows, how to proceed? To: pgsql-performance@postgresql.org Cc: X-Originating-IP: 70.137.165.85 X-Mailer: Webmin 0.940 MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.356 tagged_above=0 required=5 tests=BAYES_20, FORGED_RCVD_HELO, NO_REAL_NAME X-Spam-Level: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Archive-Number: 200611/216 X-Sequence-Number: 21986 I don't believe DROP is necessary; use TRUNCATE instead. No need to re-create dependent objects. "Peter Childs" wrote .. > On 24/11/06, Arnau wrote: > > Hi all, > > > > I have a table with statistics with more than 15 million rows. I'd > > like to delete the oldest statistics and this can be about 7 million > > rows. Which method would you recommend me to do this? I'd be also > > interested in calculate some kind of statistics about these deleted > > rows, like how many rows have been deleted for date. I was thinking in > > creating a function, any recommendations? > > > Copy and drop old table. If you delete you will have a massive problem > with a bloated table and vacuum will not help unless you expect the > table to grow to this size regulally otherwise vacuum full will take > ages. > > Peter. > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org