From: Tom Lane on
Richard Rowell <richard.rowell(a)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

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers