Re: IN vs EXIIST - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject Re: IN vs EXIIST
Date
Msg-id 3D89AF55.4000107@mega-bucks.co.jp
Whole thread Raw
In response to IN vs EXIIST  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
List pgsql-general
Henshall, Stuart - WCP wrote:
>
> AND invoice_li.invoice_id=sq_inv_li.invoice_id
> is the bit that tells it to check the id of the sub query and parent are
> the same.
> If you don't have this bit I believe it makes the subquery kind of
> piontless

You are right. I had "ordered" my data set in between running the
queries. When I added some new data running the EXISTS query without the
  AND a.id=b.id bit the results were fast *and* wrong ;)

I'm still scratching my head as to why EXISTS isn't faster *and* why
EXPLAIN says it should be ...

Jc


pgsql-general by date:

Previous
From: "Jan Weerts"
Date:
Subject: Re: IN vs EXIIST
Next
From: Ciprian Popovici
Date:
Subject: some optimization?