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 23561.987517995@sss.pgh.pa.us
Whole thread Raw
In response to Re: index not used with subselect in where clause ?  (Christian Fritze <The.Finn@sprawl.de>)
List pgsql-general
Christian Fritze <The.Finn@sprawl.de> writes:
>    explain select * from allmain where exists (select distinct
>    dokids_as_int from allslwfull where dokids_as_int = idn and
>    wort_nouml_lower like 'gen%')

Try dropping the "distinct" on the inner select.  As a moment's thought
will reveal, it's not buying you anything; and it's costing you sort
and unique passes over the subplan result.

            regards, tom lane

pgsql-general by date:

Previous
From: Rini Dutta
Date:
Subject: drastic reduction in speed of inserts as the table grows
Next
From: Tom Lane
Date:
Subject: Re: parse error at or near $1