On Thu, May 8, 2008 at 9:45 AM, Tom Hughes <[EMAIL PROTECTED]> wrote:
> No, it will almost certainly use the spatial index to find the data
> and then do the sort itself. It is almost always better to choose the
> index based on the filter rather than the sort - if the data happens
> to wind up sorted because of the index then that is a nice bonus.

Well, that's not exactly the query it will send:
osm=# explain select * from (select *from planet_osm_line order by
z_order) as foo where way && setSRID('BOX3D(-4027.889170960444
6755618.644585053,-424.8904607704981
6759221.643295237)'::box3d,900913);

But the result is the same (see below). Basically, Postgresql knows
that selection and order by commute.


                                          QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=6.02..6.03 rows=1 width=1232)
   Sort Key: planet_osm_line.z_order
   ->  Index Scan using planet_osm_line_index on planet_osm_line
(cost=0.00..6.01 rows=1 width=1232)
         Index Cond: (way &&
'010300002031BF0D00010000000500000052876A41C777AFC0ABE140A948C5594152876A41C777AFC0C9BF2B69CDC8594191FACA533F8E7AC0C9BF2B69CDC8594191FACA533F8E7AC0ABE140A948C5594152876A41C777AFC0ABE140A948C55941'::geometry)
         Filter: (way &&
'010300002031BF0D00010000000500000052876A41C777AFC0ABE140A948C5594152876A41C777AFC0C9BF2B69CDC8594191FACA533F8E7AC0C9BF2B69CDC8594191FACA533F8E7AC0ABE140A948C5594152876A41C777AFC0ABE140A948C55941'::geometry)
(5 rows)

Have a nice day,
-- 
Martijn van Oosterhout <[EMAIL PROTECTED]> http://svana.org/kleptog/
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to