Re: Index ot being used - Mailing list pgsql-performance

From Bruno Wolff III
Subject Re: Index ot being used
Date
Msg-id 20050612173732.GA28838@wolff.to
Whole thread Raw
In response to Re: Index ot being used  (Madison Kelly <linux@alteeve.com>)
List pgsql-performance
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;

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Index ot being used
Next
From: Yves Vindevogel
Date:
Subject: Updates on large tables are extremely slow