pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jonah H. Harris <jonah.harris@gmail.com>
To: Pavel Velikhov <pvelikhov@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: need help with a query
Date: Fri, 19 Oct 2007 11:52:58 -0400
Message-ID: <36e682920710190852r91139d3ge07093f791477fa8@mail.gmail.com> (raw)
In-Reply-To: <878599.37701.qm@web56406.mail.re3.yahoo.com>
References: <878599.37701.qm@web56406.mail.re3.yahoo.com>

On 10/19/07, Pavel Velikhov <pvelikhov@yahoo.com> wrote:
>
> Hi,
>
>   I am updating a big table (90M records) with data from another rather
> large table (4M entries). Here is my update query:
>
>     update links set target_size =
>     ( select size from articles where articles.article_id =
> links.article_to)

try:

UPDATE links
   SET target_size = size
  FROM articles
 WHERE articles.article_id = links.article_to;

-- 
Jonah H. Harris, Sr. Software Architect | phone: 732.331.1324
EnterpriseDB Corporation                | fax: 732.331.1301
499 Thornall Street, 2nd Floor          | jonah.harris@enterprisedb.com
Edison, NJ 08837                        | http://www.enterprisedb.com/



view thread (7+ messages)  latest in thread

Message-ID: <36e682920710190852r91139d3ge07093f791477fa8@mail.gmail.com>
Permalink:  ../36e682920710190852r91139d3ge07093f791477fa8@mail.gmail.com/
Also on:    postgresql.org/message-id/36e682920710190852r91139d3ge07093f791477fa8@mail.gmail.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: jonah.harris@gmail.com, pvelikhov@yahoo.com
  Subject: Re: need help with a query
  In-Reply-To: <36e682920710190852r91139d3ge07093f791477fa8@mail.gmail.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