Re: LIMIT 1 == EXISTS optimization? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: LIMIT 1 == EXISTS optimization?
Date
Msg-id 9560.1254508698@sss.pgh.pa.us
Whole thread Raw
In response to LIMIT 1 == EXISTS optimization?  (Richard Rowell <richard.rowell@gmail.com>)
List pgsql-hackers
Richard Rowell <richard.rowell@gmail.com> writes:
> I'm no backend guru, so I was hoping someone could explain what the original
> query-plan was doing.  If all you need to know is if a row exists, why loop
> over all 3M rows?  It seems very simplistic to assume the a LIMIT 1 clause
> on the end of all EXISTS subqueries would be a general case optimization...

[ squint... ]  It should be assuming that already.

It looks like your case might have something to do with using or not
using a partial index.  Can you extract a reproducible test case?
And what PG version is this exactly?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: remove useless set of active snap
Next
From: "David E. Wheeler"
Date:
Subject: Re: latest hstore patch