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 E2F05D1B527 for ; Mon, 13 Oct 2003 01:49:03 +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 78411-10 for ; Sun, 12 Oct 2003 22:48:34 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 1A615D1B4F4 for ; Sun, 12 Oct 2003 22:48:14 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id DF9C5353FC; Sun, 12 Oct 2003 18:48:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id DE7AB353F5; Sun, 12 Oct 2003 18:48:24 -0700 (PDT) Date: Sun, 12 Oct 2003 18:48:24 -0700 (PDT) From: Stephan Szabo To: David Griffiths Cc: pgsql-performance@postgresql.org Subject: Re: Another weird one with an UPDATE In-Reply-To: <080d01c3912a$1356dea0$6501a8c0@griffiths2> Message-ID: <20031012184536.N5307@megazone.bigpanda.com> References: <052001c39030$1ccc8020$6501a8c0@griffiths2> <05a401c3903f$a8524850$6501a8c0@griffiths2> <20031011153251.F57866@megazone.bigpanda.com> <080d01c3912a$1356dea0$6501a8c0@griffiths2> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/407 X-Sequence-Number: 4155 On Sun, 12 Oct 2003, David Griffiths wrote: > [snip] > > > 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. Hmm, does UPDATE user_account SET last_name='abc' 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; give the right results... That might end up being faster.