Re: Slow update

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 14:07:26
Message-ID: 21152.1126534046@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hilary Forbes <hforbes(at)dmr(dot)co(dot)uk> writes:
> 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;

You've written an unconstrained join to a second copy of tableA.

regards, tom lane

In response to

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

Browse pgsql-performance by date

  From Date Subject
Next Message Dave Cramer 2005-09-12 15:28:27 Re: Prepared statement not using index
Previous Message Bruno Wolff III 2005-09-12 13:34:11 Re: Slow update