Advertisement
ErshKUS

Untitled

Jul 12th, 2011
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.   t1.id,
  3.   t1.tags,
  4.   t1.linestring
  5. FROM
  6.     (SELECT
  7.       relations.id,
  8.       relations.tags,
  9.       ways.linestring
  10.     FROM
  11.       public.relations,
  12.       public.relation_members,
  13.       public.ways
  14.     WHERE
  15.       relation_members.relation_id = relations.id AND
  16.       ways.id = relation_members.member_id AND
  17.       relation_members.member_type = 'W' AND
  18.       relations.tags->'boundary' = 'administrative' AND
  19.       relations.tags->'admin_level' = '6') as t1
  20. WHERE
  21.   (t1.linestring && (SELECT geom FROM search ) AND ST_Intersects(t1.linestring, (SELECT geom FROM search )))
  22. ;
  23.  
  24. -----------------------------------------------------------------
  25.  
  26. "QUERY PLAN"
  27. "Nested Loop  (cost=2.48..19.61 rows=1 width=947)"
  28. "  InitPlan 1 (returns $0)"
  29. "    ->  Seq Scan on search  (cost=0.00..1.24 rows=24 width=32)"
  30. "  InitPlan 2 (returns $1)"
  31. "    ->  Seq Scan on search  (cost=0.00..1.24 rows=24 width=32)"
  32. "  ->  Nested Loop  (cost=0.00..16.81 rows=1 width=915)"
  33. "        ->  Index Scan using idx_ways_linestring on ways  (cost=0.00..8.53 rows=1 width=915)"
  34. "              Index Cond: (linestring && $0)"
  35. "              Filter: st_intersects(linestring, $1)"
  36. "        ->  Index Scan using idx_relation_members_member_id_and_type on relation_members  (cost=0.00..8.28 rows=1 width=16)"
  37. "              Index Cond: ((relation_members.member_id = ways.id) AND (relation_members.member_type = 'W'::bpchar))"
  38. "  ->  Index Scan using pk_relations on relations  (cost=0.00..0.30 rows=1 width=40)"
  39. "        Index Cond: (relations.id = relation_members.relation_id)"
  40. "        Filter: (((relations.tags -> 'boundary'::text) = 'administrative'::text) AND ((relations.tags -> 'admin_level'::text) = '6'::text))"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement