Re: IN vs EXIIST - Mailing list pgsql-general

From Jochem van Dieten
Subject Re: IN vs EXIIST
Date
Msg-id 1032434291.3d89b27334cc7@webmail.oli.tudelft.nl
Whole thread Raw
In response to Re: IN vs EXIIST  ("Jan Weerts" <j.weerts@i-views.de>)
List pgsql-general
Quoting Jan Weerts <j.weerts@i-views.de>:
>
> One
> of our expensive queries contains NOT IN and IN as subqueries. As I
> was advised on this list, I tried to replace IN with EXISTS. When
> doing so for part of the query (omitting one of the IN subqueries)
> the IN and EXIST versions are both about the same speed in execution
> (about 30sec).

I am wondering if the NOT might negate any positive effects from the
switch to EXIST.


> My next plan is to switch from 7.1.3 to 7.2, but that requires some
> planning, as the database is permamently used.

I would say that is a good idea anyway, but maybe you can post your
query. There might be a way to totally rewrite it like the CASE & GROUP
BY idea for Jean-Christian (not that that idea is faster by definition,
but you never know).

Jochem

pgsql-general by date:

Previous
From: Ciprian Popovici
Date:
Subject: some optimization?
Next
From: dima
Date:
Subject: Re: some optimization?