Skip site navigation (1) Skip section navigation (2)

Re: Slow update

From: Richard Huxton <dev(at)archonet(dot)com>
To: Hilary Forbes <hforbes(at)dmr(dot)co(dot)uk>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow update
Date: 2005-09-12 10:51:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
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

In response to

  • Slow update at 2005-09-12 09:14:25 from Hilary Forbes

pgsql-performance by date

Next:From: Dave CramerDate: 2005-09-12 12:38:35
Subject: Re: Prepared statement not using index
Previous:From: Manfred KoizarDate: 2005-09-12 10:41:28
Subject: Re: LEFT JOIN optimization

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group