Re: Speeding up subselect ? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Speeding up subselect ?
Date
Msg-id 20020709103422.B29704@svana.org
Whole thread Raw
In response to Speeding up subselect ?  ("Peter Alberer" <h9351252@obelix.wu-wien.ac.at>)
List pgsql-general
On Mon, Jul 08, 2002 at 06:10:05PM +0200, Peter Alberer wrote:
> Hi there,
>
> i have the following query in a pl/pgsql procedure:
>
>     update lr_object_usage
>     set status = (case status
>         when ''OPEN_SUCC'' then ''CLOSED_SUCC''
>         when ''OPEN_FAIL'' then ''CLOSED_FAIL'' end)
>     where lr_object_usage_id in (select lr_object_usage_id from
> lr_locked_objects where context = p_exam_usage_id);

Read the FAQ. Use EXISTS rather than IN.
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.



pgsql-general by date:

Previous
From: Darren Ferguson
Date:
Subject: Re: Speeding up subselect ?
Next
From: Ricardo Junior
Date:
Subject: Re: PostgreSQL doesn't use indexes even is enable_seqscan