hstore-rendering=> create index berlin_osm_dual_point_tags on berlin_osm_dual_point using gin (tags); hstore-rendering=> alter table berlin_osm_dual_point alter column tags set statistics 250; hstore-rendering=> analyze berlin_osm_dual_point; hstore-rendering=> hstore-rendering=> create index berlin_osm_dual_point_amenity on berlin_osm_dual_point using btree (amenity); hstore-rendering=> alter table berlin_osm_dual_point alter column amenity set statistics 250; hstore-rendering=> analyze berlin_osm_dual_point; hstore-rendering=> hstore-rendering=> explain analyze select count(*) from berlin_osm_dual_point where (tags ? 'amenity'); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=169.10..169.11 rows=1 width=0) (actual time=17.233..17.234 rows=1 loops=1) -> Bitmap Heap Scan on berlin_osm_dual_point (cost=4.66..168.98 rows=50 width=0) (actual time=4.462..13.061 rows=11528 loops=1) Recheck Cond: (tags ? 'amenity'::text) -> Bitmap Index Scan on berlin_osm_dual_point_tags (cost=0.00..4.65 rows=50 width=0) (actual time=4.024..4.024 rows=11528 loops=1) Index Cond: (tags ? 'amenity'::text) Total runtime: 17.371 ms (6 Zeilen) hstore-rendering=> explain analyze select count(*) from berlin_osm_dual_point where not amenity is null; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1545.66..1545.67 rows=1 width=0) (actual time=28.428..28.429 rows=1 loops=1) -> Seq Scan on berlin_osm_dual_point (cost=0.00..1516.84 rows=11528 width=0) (actual time=0.018..24.177 rows=11528 loops=1) Filter: (NOT (amenity IS NULL)) Total runtime: 28.549 ms (4 Zeilen) hstore-rendering=> explain analyze select count(*) from berlin_osm_dual_point where (tags->'amenity' = 'restaurant'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=1768.89..1768.90 rows=1 width=0) (actual time=59.682..59.682 rows=1 loops=1) -> Seq Scan on berlin_osm_dual_point (cost=0.00..1768.26 rows=251 width=0) (actual time=0.163..59.236 rows=1221 loops=1) Filter: ((tags -> 'amenity'::text) = 'restaurant'::text) Total runtime: 59.791 ms (4 Zeilen) hstore-rendering=> explain analyze select count(*) from berlin_osm_dual_point where amenity = 'restaurant'; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1110.45..1110.46 rows=1 width=0) (actual time=3.592..3.593 rows=1 loops=1) -> Bitmap Heap Scan on berlin_osm_dual_point (cost=25.72..1107.39 rows=1221 width=0) (actual time=0.951..3.108 rows=1221 loops=1) Recheck Cond: (amenity = 'restaurant'::text) -> Bitmap Index Scan on berlin_osm_dual_point_amenity (cost=0.00..25.41 rows=1221 width=0) (actual time=0.688..0.688 rows=1221 loops=1) Index Cond: (amenity = 'restaurant'::text) Total runtime: 3.718 ms (6 Zeilen)