Re: Index ot being used

From: Madison Kelly <linux(at)alteeve(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, tgl(at)sss(dot)pgh(dot)pa(dot)us, tobias(at)nordicbet(dot)com
Subject: Re: Index ot being used
Date: 2005-06-13 17:57:31
Message-ID: 42ADC90B.4040808@alteeve.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Kevin Grittner wrote:
>>tle-bu=> \d file_info_7_display_idx
>> Index "public.file_info_7_display_idx"
>> Column | Type
>>-----------------+----------------------
>> file_type | character varying(2)
>> file_parent_dir | text
>> file_name | text
>>btree, for table "public.file_info_7"
>
>
> The index is fine, but you need to phrase the query as
>
> ... ORDER BY file_type, file_parent_dir, file_name;
>
> (Whether you use ASC or not doesn't matter.) Otherwise the planner
> won't make the connection to the sort ordering of the index.
>
> regards, tom lane

With Bruno's help I've gone back and tried just this with no luck. I've
re-written the query to include all three items in the 'ORDER BY...'
column in the same order but the sort still takes a long time and a
sequential scan is being done instead of using the index.

For what it's worth, and being somewhat of a n00b, I agree with the idea
of a smarter, more flexible planner. I guess the trade off is the added
overhead neaded versus the size of the average query.

Madison

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Madison Kelly (Digimer)
TLE-BU, The Linux Experience; Back Up
http://tle-bu.thelinuxexperience.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-06-13 18:13:23 Re: Index ot being used
Previous Message Madison Kelly 2005-06-13 17:50:51 Re: Index ot being used