]> granicus.if.org Git - postgis/commitdiff
Create indices on start_node and end_node of edge_data (#2082)
authorSandro Santilli <strk@keybit.net>
Mon, 5 Nov 2012 10:27:08 +0000 (10:27 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 5 Nov 2012 10:27:08 +0000 (10:27 +0000)
Those indices speed up nodes deletion by a factor of x1000 !
I didn't profile, but I suspect those indices would also speed up
ring walking (whereas you have to find a match between endnodes).

git-svn-id: http://svn.osgeo.org/postgis/trunk@10644 b70326c6-7e19-0410-871a-916f4a2858ee

topology/topology.sql.in.c

index b8e67ffe2fbb5c41c851a6f738cba9e09e1d6003..09a88c07823fecaa4254158cd11f58d8f2f41252 100644 (file)
@@ -1855,6 +1855,19 @@ BEGIN
     || quote_ident(atopology)
     || '.edge_data (right_face);';
 
+  ------- Indexes on start_node and end_node of edge_data
+  ------- NOTE: this indexes speed up node deletion
+  -------       by a factor of 1000 !
+  -------       See http://trac.osgeo.org/postgis/ticket/2082
+  EXECUTE 'CREATE INDEX edge_start_node_idx ON '
+    || quote_ident(atopology)
+    || '.edge_data (start_node);';
+  EXECUTE 'CREATE INDEX edge_end_node_idx ON '
+    || quote_ident(atopology)
+    || '.edge_data (end_node);';
+
+  -- TODO: consider also adding an index on node.containing_face 
+
   ------- Add record to the "topology" metadata table
   EXECUTE 'INSERT INTO topology.topology '
     || '(id, name, srid, precision, hasZ) VALUES ('