Skip site navigation (1) Skip section navigation (2)

Re: need help with a query

From: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
To: "Pavel Velikhov" <pvelikhov(at)yahoo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: need help with a query
Date: 2007-10-19 15:52:58
Message-ID: 36e682920710190852r91139d3ge07093f791477fa8@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
On 10/19/07, Pavel Velikhov <pvelikhov(at)yahoo(dot)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(dot)harris(at)enterprisedb(dot)com
Edison, NJ 08837                        | http://www.enterprisedb.com/

In response to

pgsql-performance by date

Next:From: Pavel VelikhovDate: 2007-10-19 16:11:36
Subject: Re: need help with a query
Previous:From: Pavel VelikhovDate: 2007-10-19 15:05:15
Subject: need help with a query

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group