Re: IN vs EXIIST

From: Jochem van Dieten <jochemd(at)oli(dot)tudelft(dot)nl>
To: Jan Weerts <j(dot)weerts(at)i-views(dot)de>
Cc: "'pgsql-general'" <pgsql-general(at)postgresql(dot)org>, "'Jean-Christian Imbeault'" <jc(at)mega-bucks(dot)co(dot)jp>
Subject: Re: IN vs EXIIST
Date: 2002-09-19 11:18:11
Message-ID: 1032434291.3d89b27334cc7@webmail.oli.tudelft.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Quoting Jan Weerts <j(dot)weerts(at)i-views(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message dima 2002-09-19 11:20:43 Re: some optimization?
Previous Message Ciprian Popovici 2002-09-19 11:14:52 some optimization?