Re: need help with a query - Mailing list pgsql-performance

From Jonah H. Harris
Subject Re: need help with a query
Date
Msg-id 36e682920710190852r91139d3ge07093f791477fa8@mail.gmail.com
Whole thread Raw
In response to need help with a query  (Pavel Velikhov <pvelikhov@yahoo.com>)
List pgsql-performance
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/

pgsql-performance by date:

Previous
From: Pavel Velikhov
Date:
Subject: need help with a query
Next
From: Pavel Velikhov
Date:
Subject: Re: need help with a query