pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Griffiths <dgriffiths@boats.com>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Another weird one with an UPDATE
Date: Sat, 11 Oct 2003 22:35:39 -0700
Message-ID: <06d701c39082$ae32aa10$6501a8c0@griffiths2> (raw)
References: <052001c39030$1ccc8020$6501a8c0@griffiths2>
	<05a401c3903f$a8524850$6501a8c0@griffiths2>
	<20031011153251.F57866@megazone.bigpanda.com>

Thanks - that worked.

David
----- Original Message -----
From: "Stephan Szabo" <sszabo@megazone.bigpanda.com>
To: "David Griffiths" <dgriffiths@boats.com>
Cc: <pgsql-performance@postgresql.org>
Sent: Saturday, October 11, 2003 3:34 PM
Subject: Re: [PERFORM] Another weird one with an UPDATE


> On Sat, 11 Oct 2003, David Griffiths wrote:
>
> > Sorry - just found the FAQ (
> > http://jamesthornton.com/postgres/FAQ/faq-english.html#4.22
> > <http://jamesthornton.com/postgres/FAQ/faq-english.html#4.22; ) on how
> > IN is very slow.
> >
> > So I rewrote the query:
> >
> > \o ./data/temp.txt
> > SELECT current_timestamp;
> > UPDATE user_account SET last_name = 'abc'
> > WHERE EXISTS (SELECT ua.user_account_id FROM user_account ua,
> > commercial_entity ce, commercial_service cs
> > WHERE ua.user_account_id = ce.user_account_id AND
> > ce.commercial_entity_id = cs.commercial_entity_id);
> > SELECT current_timestamp;
>
> I don't think that's the query you want.  You're not binding the subselect
> to the outer values of user_account.
>
> 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);



view thread (12+ messages)  latest in thread

Message-ID: <06d701c39082$ae32aa10$6501a8c0@griffiths2>
Permalink:  ../06d701c39082$ae32aa10$6501a8c0@griffiths2/
Also on:    postgresql.org/message-id/06d701c39082$ae32aa10$6501a8c0@griffiths2

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dgriffiths@boats.com, sszabo@megazone.bigpanda.com
  Subject: Re: Another weird one with an UPDATE
  In-Reply-To: <06d701c39082$ae32aa10$6501a8c0@griffiths2>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox