Re: Slow update - Mailing list pgsql-performance

From Tom Lane
Subject Re: Slow update
Date
Msg-id 21152.1126534046@sss.pgh.pa.us
Whole thread Raw
In response to Slow update  (Hilary Forbes <hforbes@dmr.co.uk>)
List pgsql-performance
Hilary Forbes <hforbes@dmr.co.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

pgsql-performance by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Slow update
Next
From: Dave Cramer
Date:
Subject: Re: Prepared statement not using index