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)
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
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)