[BUGS] Possible bug in query planner when using DISTINCT

2002-11-15 Thread Nick Howden
Using postgres 7.2.3 the query planner seems to lose interest in using indexes when DISTINCT is used. Sample query without DISTINCT: SELECT ps_7.id, FROM ps_7, page WHERE page.id = ps_7.id ORDER BY ps_7.id DESC LIMIT 5; NOTICE: QUERY PLAN: Limit (cost=0.00..33.22 rows=5 width=16)

Re: [BUGS] Possible bug in query planner when using DISTINCT

2002-11-14 Thread Tom Lane
Nick Howden <[EMAIL PROTECTED]> 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 entir

[BUGS] Possible bug in query planner when using DISTINCT

2002-11-13 Thread Nick Howden
Using postgres 7.2.3 the query planner seems to lose interest in using indexes when DISTINCT is used. Sample query without DISTINCT: SELECT ps_7.id, FROM ps_7, page WHERE page.id = ps_7.id ORDER BY ps_7.id DESC LIMIT 5; NOTICE: QUERY PLAN: Limit (cost=0.00..33.22 rows=5 width=16)