X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 46C7BD1B503 for ; Mon, 13 Oct 2003 06:13:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 37780-01 for ; Mon, 13 Oct 2003 03:13:01 -0300 (ADT) Received: from boats_exch01.boats.com (h209-17-182-106.gtconnect.net [209.17.182.106]) by svr1.postgresql.org (Postfix) with ESMTP id C0903D1B4FC for ; Mon, 13 Oct 2003 03:12:59 -0300 (ADT) Received: by BOATS_EXCH01 with Internet Mail Service (5.5.2653.19) id <4S92KHVB>; Sun, 12 Oct 2003 23:11:17 -0700 Received: from GRIFFITHS2 ([192.168.12.192]) by boats_exch01.boats.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 4S92KH48; Sun, 12 Oct 2003 23:11:08 -0700 From: David Griffiths To: pgsql-performance@postgresql.org Message-ID: <098a01c39152$3e231c20$6501a8c0@griffiths2> References: <052001c39030$1ccc8020$6501a8c0@griffiths2> <05a401c3903f$a8524850$6501a8c0@griffiths2> <20031011153251.F57866@megazone.bigpanda.com> <080d01c3912a$1356dea0$6501a8c0@griffiths2> <3F8A01CE.2040003@joeconway.com> Subject: Re: Another weird one with an UPDATE Date: Sun, 12 Oct 2003 23:21:24 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4922.1500 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/409 X-Sequence-Number: 4157 Yes, the query operates only on indexed columns (all numeric(10)'s). Column | Type | Modifiers -------------------------------+-----------------------------+-------------- --------------- user_account_id | numeric(10,0) | not null [snip] Indexes: user_account_pkey primary key btree (user_account_id), Foreign Key constraints: $1 FOREIGN KEY (lang_id) REFERENCES lang(lang_id) ON UPDATE NO ACTION ON DELETE NO ACTION, $2 FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE NO ACTION ON DELETE NO ACTION, $3 FOREIGN KEY (user_role_id) REFERENCES user_role(user_role_id) ON UPDATE NO ACTION ON DELETE NO ACTION David ----- Original Message ----- From: "Joe Conway" To: "David Griffiths" Cc: Sent: Sunday, October 12, 2003 6:37 PM Subject: Re: [PERFORM] Another weird one with an UPDATE > David Griffiths wrote: > >>I think you want something like: > >>UPDATE user_account SET last_name = 'abc' > >> WHERE EXISTS (SELECT 1 FROM commercial_entity ce, commercial_service cs > >> WHERE user_account.user_account_id = ce.user_account_id AND > >> ce.commercial_entity_id = cs.commercial_entity_id); > > > > Unfort, this is still taking a long time. > > ------- > > Seq Scan on user_account (cost=0.00..748990.51 rows=36242 width=716) > > Do you have an index on user_account.user_account_id? > > Joe