Hi
Am 20.12.2011 19:29, schrieb Peter Wendorff:
Thanks for that hint, but I fear, it's not completely correct what you wrote...
I want to ask, if a specific value is contained in an array. Your query would create an array, I think (that's correct for update, but wrong for select).
Have you actually tried that?
http://www.openstreetmap.org/browse/node/311596461
osm_mapnik=> select id from planet_ways where nodes && ARRAY[311596461]; id ----------- 28320526 131908054 (2 rows)
osm_mapnik=> explain analyze select id from planet_ways where nodes && ARRAY[311596461]; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- Bitmap Heap Scan on planet_ways (cost=6259.91..1647787.21 rows=581665 width=4) (actual time=0.145..0.167 rows=2 loops=1) Recheck Cond: (nodes && '{311596461}'::integer[]) -> Bitmap Index Scan on planet_ways_nodes (cost=0.00..6114.49 rows=581665 width=0) (actual time=0.114..0.114 rows=2 loops=1) Index Cond: (nodes && '{311596461}'::integer[]) Total runtime: 0.219 ms (5 rows)
ARRAY[311596461] creates an array, the && operator compares it against the nodes array.
Peter