On Sun, Jun 12, 2005 at 10:12:27 -0400,
Madison Kelly <linux@alteeve.com> wrote:
> Indexes:
> "file_info_7_display_idx" btree (file_type, file_parent_dir, file_name)
> Here is my full query:
>
> tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_type
> FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC,
> file_name ASC;
> QUERY PLAN
>
-----------------------------------------------------------------------------------------------------------------------------
This is a case where postgres's planner can't make a deduction needed for
it to realize that the index can be used. Try rewriting the query as:
SELECT file_name, file_parent_dir, file_type
FROM file_info_7 WHERE file_type='d'
ORDER BY file_type ASC, file_parent_dir ASC, file_name ASC;