pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Hilary Forbes <hforbes@dmr.co.uk>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow update
Date: Mon, 12 Sep 2005 11:51:17 +0100
Message-ID: <43255DA5.9030602@archonet.com> (raw)
In-Reply-To: <5.1.0.14.0.20050912100150.01f47f18@mailserver.dmr.co.uk>
References: <5.1.0.14.0.20050912100150.01f47f18@mailserver.dmr.co.uk>

Hilary Forbes wrote:
> 
> I need to set the value of a field in table A to a value in table B depending on the existence of the record in table B.  So what I have done is
> 
> UPDATE tableA set a.val1=b.somefield FROM tableA a, tableB b WHERE a.key1=b.key1;

Check the EXPLAIN carefully, are you sure the tableA in "UPDATE" is the 
same as that in your "FROM" clause. If so, why are you SETting a.val1?

If not, you've probably got an unconstrained join.
--
   Richard Huxton
   Archonet Ltd



view thread (18+ messages)  latest in thread

Message-ID: <43255DA5.9030602@archonet.com>
Permalink:  ../43255DA5.9030602@archonet.com/
Also on:    postgresql.org/message-id/43255DA5.9030602@archonet.com

 · 

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: dev@archonet.com, hforbes@dmr.co.uk
  Subject: Re: Slow update
  In-Reply-To: <43255DA5.9030602@archonet.com>

* 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