Hannu Krosing kirjutas N, 04.12.2003 kell 23:01:
>
> > Where should I be looking in the code?
>
> Try to find where the modified query is tested for. It's probably be
> inside the optimizer, as index scan + no sort is not always faster than
> seq scan + sort, as shown by the same query after vacuum analyze (on an
> empty table)
OTOH, it may be that all combinations of sort and index and where are
not watched in the optimiser proper at all (too compliaced and/or too
costly), but a keyhole optimiser is run over its resulting "best" plan
to remove redundant sorts (but it misses combinations of sort and where
like the one in your example)
---------------
Hannu