pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Kevin Kempter <cs_dba@consistentstate.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Update join performance issues
Date: Tue, 03 Apr 2012 13:39:05 -0400
Message-ID: <4F7B35B9.50108@dunslane.net> (raw)
In-Reply-To: <4F7B3394.3030703@consistentstate.com>
References: <4F7B3394.3030703@consistentstate.com>



On 04/03/2012 01:29 PM, Kevin Kempter wrote:
> Hi All;
>
> I have a query that wants to update a table based on a join like this:
>
> update test_one
> set f_key = t.f_key
> from
>     upd_temp1 t,
>     test_one t2
> where
>     t.id_number = t2.id_number


Why is test_one in the from clause? update joins whatever is in the from 
clause to the table being updated. You almost never need it repeated in 
the from clause.


cheers

andrew






view thread (6+ messages)  latest in thread

Message-ID: <4F7B35B9.50108@dunslane.net>
Permalink:  ../4F7B35B9.50108@dunslane.net/
Also on:    postgresql.org/message-id/4F7B35B9.50108@dunslane.net

 · 

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: andrew@dunslane.net, cs_dba@consistentstate.com
  Subject: Re: Update join performance issues
  In-Reply-To: <4F7B35B9.50108@dunslane.net>

* 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