Re: index not used with subselect in where clause ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christian Fritze <The(dot)Finn(at)sprawl(dot)de>
Cc: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: index not used with subselect in where clause ?
Date: 2001-04-17 14:33:15
Message-ID: 23561.987517995@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christian Fritze <The(dot)Finn(at)sprawl(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marek Pętlicki 2001-04-17 14:46:08 failed sanity check, table answers was not found
Previous Message Rini Dutta 2001-04-17 14:28:53 drastic reduction in speed of inserts as the table grows