[PERFORM] Index usage for sorted query

2004-11-20 Thread Markus Schaber
Hello, I have the following query plan: logigis=# explain SELECT geom, ref_in_id as ref, nref_in_id as nref, st_name as name, substr(l_postcode,1,2) as postfirst, func_class as level FROM schabi.streets WHERE cd='ca' ORDER BY l_postcode; QUERY PLAN

Re: [PERFORM] Index usage for sorted query

2004-11-20 Thread Pierre-Frdric Caillaud
Instead of : WHERE cd='ca' ORDER BY l_postcode; Write : WHERE cd='ca' ORDER BY cd, l_postcode; You have a multicolumn index, so you should specify a multicolumn sort exactly the same as your index, and the planner will get it. ---(end of

Re: [PERFORM] Index usage for sorted query

2004-11-20 Thread Tom Lane
Markus Schaber [EMAIL PROTECTED] writes: But as it fetches all the rows through the index, why doesn't it recognize that, fetching this way, the rows are already sorted by l_postcode? Tell it to ORDER BY cd, l_postcode. Is Postgresql 8 more intelligend in this case? No.

Re: [PERFORM] index use

2004-11-20 Thread Josh Berkus
Arshavir, Thanks for all the replies. It actually has to do with the locales. The db where the index gets used is running on C vs the the other one that uses en_US.UTF-8. I guess the db with the wrong locale will need to be waxed and recreated with correct locale settings. I wonder if there

Re: [PERFORM] tablespace + RAM disk?

2004-11-20 Thread Josh Berkus
David, But, I'm also still interested in the answer to my question: is there any reason you could not put an 8.0 tablespace on a RAM disk? Some people have *talked* about trying it, but nobody yet has reported back. I can see a few potential problems: 1) The query planner would not be