[OSM-Devserver] Tag queries extremely slow

Kay Drangmeister kay at drangmeister.net
Di Jun 1 17:42:10 CEST 2010


Hi.

I started the following (simple) query on devserver and for comparison
on toolserver:

hstore=> EXPLAIN ANALYZE SELECT 
osm_id,text(tags->'parking:condition:left:vehicles') as 
"parking:condition:left:vehicles" FROM planet_line WHERE (tags ? 
'parking:condition:left:vehicles');
                                                         QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------
 Seq Scan on planet_line  (cost=0.00..2625891.24 rows=34947 width=210) 
(actual time=2563623.450..4016718.418 rows=4 loops=1)
   Filter: (tags ? 'parking:condition:left:vehicles'::text)
 Total runtime: 4016748.084 ms
(3 Zeilen)

osm_mapnik=> EXPLAIN ANALYZE SELECT 
osm_id,text(tags->'parking:condition:left:vehicles') as 
"parking:condition:left:vehicles" FROM planet_line WHERE (tags ? 
'parking:condition:left:vehicles');
                                                           QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------
 Bitmap Heap Scan on planet_line  (cost=3470.04..129424.69 rows=34857 
width=211) (actual time=0.135..0.144 rows=4 loops=1)
   Recheck Cond: (tags ? 'parking:condition:left:vehicles'::text)
   ->  Bitmap Index Scan on planet_line_tags  (cost=0.00..3461.33 
rows=34857 width=0) (actual time=0.080..0.080 rows=4 loops=1)
         Index Cond: (tags ? 'parking:condition:left:vehicles'::text)
 Total runtime: 0.226 ms
(5 rows)

so the factor of about 20.000.000 (sic!) is easily explained by a 
missing index on tags.
Is this going to be changed?

Ciao,
Kay