X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 563C0D1B4DB for ; Mon, 15 Mar 2004 21:53:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06331-07 for ; Mon, 15 Mar 2004 17:53:57 -0400 (AST) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id D32A3D1D549 for ; Mon, 15 Mar 2004 17:53:54 -0400 (AST) Received: from [134.22.71.76] (dyn-71-76.tor.dsl.tht.net [134.22.71.76]) by tht.net (Postfix) with ESMTP id 4BAE176A43; Mon, 15 Mar 2004 16:53:57 -0500 (EST) Subject: Re: atrocious update performance From: Rod Taylor To: Rosser Schwarz Cc: 'Postgresql Performance' In-Reply-To: <001501c40ad2$b3f7ade0$2500fa0a@CardServices.TCI.com> References: <001501c40ad2$b3f7ade0$2500fa0a@CardServices.TCI.com> Content-Type: text/plain Message-Id: <1079387674.33643.12.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Mon, 15 Mar 2004 16:54:35 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/207 X-Sequence-Number: 6063 On Mon, 2004-03-15 at 16:15, Rosser Schwarz wrote: > > > # explain update account.cust set prodid = tempprod.prodid > > > where tempprod.did = origid; > > > > Merge Join (cost=0.00..232764.69 rows=4731410 width=252) > > > Merge Cond: (("outer".origid)::text = ("inner".did)::text) > > > -> Index Scan using ix_origid on cust (cost=0.00..94876.83 > > > rows=4731410 width=244) > > > -> Index Scan using ix_did on tempprod (cost=0.00..66916.71 > > > rows=4731410 width=18) > > > I'm going to hazard a guess and say you have a number of foreign keys > > that refer to account.cust.prodid? This is probably the time consuming > > part -- perhaps even a missing index on one of those keys > > that refers to > > this field. > > Actually, there are no foreign keys to those columns. Once they're > populated, I'll apply a foreign key constraint and they'll refer to the > appropriate row in the prod and subprod tables, but nothing will > reference account.cust.[sub]prodid. There are, of course, several foreign > keys referencing account.cust.custid. If there are no feign keys to it, I wouldn't expect it to take more than 10 minutes on slow hardware. Fresh out of ideas here.