X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C95D7D1B442; Wed, 17 Dec 2003 00:04:59 +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 33703-06; Tue, 16 Dec 2003 20:04:31 -0400 (AST) Received: from mail.osdl.org (fw.osdl.org [65.172.181.6]) by svr1.postgresql.org (Postfix) with ESMTP id E3405D1BB71; Tue, 16 Dec 2003 20:04:26 -0400 (AST) Received: from ibm-a.pdx.osdl.net (ibm-a.pdx.osdl.net [172.20.1.50]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id hBH04QZ25571; Tue, 16 Dec 2003 16:04:26 -0800 Subject: Re: update slows down in pl/pgsql function From: Jenny Zhang To: Stephan Szabo Cc: perf-pgsql , general-pgsql In-Reply-To: <20031216155342.J28271@megazone.bigpanda.com> References: <1071618760.10925.17.camel@ibm-a.pdx.osdl.net> <20031216155342.J28271@megazone.bigpanda.com> Content-Type: text/plain Organization: osdl Message-Id: <1071619646.10925.19.camel@ibm-a.pdx.osdl.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Tue, 16 Dec 2003 16:07:26 -0800 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/919 X-Sequence-Number: 54312 Oops, I named the var name the same as the column name. Changing it to something else solved the problem. Thanks, Jenny On Tue, 2003-12-16 at 15:54, Stephan Szabo wrote: > On Tue, 16 Dec 2003, Jenny Zhang wrote: > > > I have stored procedure written in pl/pgsql which takes about 13 seconds > > to finish. I was able to identify that the slowness is caused by one > > update SQL: > > > > UPDATE shopping_cart SET sc_sub_total=sc_subtotal, sc_date=now() > > WHERE sc_id=sc_id; > > Umm, is that exactly the condition you're using? Isn't that going to > update the entire table? > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match