Re: index not used with subselect in where clause ? - Mailing list pgsql-general

From Tom Lane
Subject Re: index not used with subselect in where clause ?
Date
Msg-id 23743.987520162@sss.pgh.pa.us
Whole thread Raw
In response to Re: index not used with subselect in where clause ?  ("Rod Taylor" <rod.taylor@inquent.com>)
List pgsql-general
"Rod Taylor" <rod.taylor@inquent.com> writes:
> Adding a LIMIT 1 in the subplan may also help -- as you only need a
> single match to make it true so additional finds are useless -- it'll
> stop sooner or will be more likely to use an index than a full table
> scan.

I believe this is not necessary; the WHERE EXISTS(...) context is
sufficient to cue the planner that only one tuple will be retrieved,
and it will alter the subselect's plan accordingly.

            regards, tom lane

pgsql-general by date:

Previous
From: Peter T Mount
Date:
Subject: Re: JDBC & large Objects
Next
From: Matthew
Date:
Subject: RE: failed sanity check, table answers was not found