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

From Madison Kelly
Subject Re: Index ot being used
Date
Msg-id 42ADC90B.4040808@alteeve.com
Whole thread Raw
In response to Re: Index ot being used  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List 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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

pgsql-performance by date:

Previous
From: Madison Kelly
Date:
Subject: Re: Index ot being used
Next
From: Tom Lane
Date:
Subject: Re: Index ot being used