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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster