Re: Performance Concern - Mailing list pgsql-performance

From Manfred Koizar
Subject Re: Performance Concern
Date
Msg-id 1fqppvc6j3jbj2ifsh2qaagdrtsl52gab8@email.aon.at
Whole thread Raw
In response to Re: Performance Concern  (Hannu Krosing <hannu@tm.ee>)
List pgsql-performance
On Sun, 26 Oct 2003 00:13:36 +0300, Hannu Krosing <hannu@tm.ee> wrote:
>UPDATE baz
>   SET customer_id = '1234'
> WHERE baz_key IN (
>    SELECT baz_key
>      FROM baz innerbaz
>     WHERE customer_id IS NULL
>       and innerbaz.baz_key = baz.baz_key
>     LIMIT 1000 );

AFAICS this is not what the OP intended.  It is equivalent to

    UPDATE baz
       SET customer_id = '1234'
     WHERE customer_id IS NULL;

because the subselect is now correlated to the outer query and is
evaluated for each row of the outer query which makes the LIMIT clause
ineffective.

Servus
 Manfred

pgsql-performance by date:

Previous
From: Neil Conway
Date:
Subject: Re: explicit casting required for index use
Next
From: Christopher Browne
Date:
Subject: Re: Various performance questions