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 C0F17D1B494; Tue, 16 Dec 2003 23:55:03 +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 32497-06; Tue, 16 Dec 2003 19:54:34 -0400 (AST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 14236D1B447; Tue, 16 Dec 2003 19:54:32 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 3BD0C3548A; Tue, 16 Dec 2003 15:54:34 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 3A54235405; Tue, 16 Dec 2003 15:54:34 -0800 (PST) Date: Tue, 16 Dec 2003 15:54:34 -0800 (PST) From: Stephan Szabo To: Jenny Zhang Cc: perf-pgsql , pgsql-general@postgresql.org Subject: Re: update slows down in pl/pgsql function In-Reply-To: <1071618760.10925.17.camel@ibm-a.pdx.osdl.net> Message-ID: <20031216155342.J28271@megazone.bigpanda.com> References: <1071618760.10925.17.camel@ibm-a.pdx.osdl.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/918 X-Sequence-Number: 54311 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?