Re: Index ot being used

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Madison Kelly <linux(at)alteeve(dot)com>
Cc: Tobias Brox <tobias(at)nordicbet(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Index ot being used
Date: 2005-06-12 17:37:32
Message-ID: 20050612173732.GA28838@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, Jun 12, 2005 at 10:12:27 -0400,
Madison Kelly <linux(at)alteeve(dot)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;

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Yves Vindevogel 2005-06-12 17:40:29 Updates on large tables are extremely slow
Previous Message Tom Lane 2005-06-12 15:56:23 Re: Index ot being used