Re: Possible bug in query planner when using DISTINCT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: n(dot)howden(at)eris(dot)qinetiq(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Possible bug in query planner when using DISTINCT
Date: 2002-11-14 19:25:33
Message-ID: 16982.1037301933@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Nick Howden <n(dot)howden(at)eris(dot)qinetiq(dot)com> writes:
> Using postgres 7.2.3 the query planner seems to lose interest in using
> indexes when DISTINCT is used.

I don't think this is a bug. DISTINCT requires a sort step, so even
though you have a LIMIT, the planner has to plan on the basis of reading
the entire join table. The nestloop plan loses badly on that basis.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Theodore Petrosky 2002-11-15 12:32:43 new journaling system in OSX
Previous Message William 2002-11-14 14:59:29 答复: [BUGS] Bug #818: There are no aggregate functions for type RELTIME