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 B97DE537D6 for ; Fri, 25 Mar 2005 05:25:13 +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 46445-06 for ; Fri, 25 Mar 2005 05:25:04 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id E2631537DF for ; Fri, 25 Mar 2005 05:25:03 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7165492; Thu, 24 Mar 2005 21:26:53 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Karim Nassar Subject: Re: Delete query takes exorbitant amount of time Date: Thu, 24 Mar 2005 21:24:39 -0800 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: <1111709457.9085.127.camel@k2.cet.nau.edu> <2630.1111711927@sss.pgh.pa.us> <1111715304.9089.179.camel@k2.cet.nau.edu> In-Reply-To: <1111715304.9089.179.camel@k2.cet.nau.edu> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200503242124.39558.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/536 X-Sequence-Number: 11241 Karim, > Problem now is: this referencing table I expect to grow to about 110 > million rows in the next 2 months, then by 4 million rows per month > thereafter. I expect that the time for recreating the foreign key will > grow linearly with size. > > Is this just the kind of thing I need to watch out for? Any other > suggestions for dealing with tables of this size? What can I do to my > indexes to make them mo' betta? How about getting some decent disk support? A single 10K SCSI disk is a bit sub-par for a database with 100's of millions of records. Too bad you didn't get a v40z ... Beyond that, you'll want to do the same thing whenever you purge the referencing table; drop keys, delete, re-create keys. Or think about why it is you need to delete batches of records from this FKed table at all. -- Josh Berkus Aglio Database Solutions San Francisco