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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-performance by date

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