From 237ca9551764f62cfa9efaf37129ac1e4beb63eb Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 16 Jan 2012 08:25:08 +0000 Subject: [PATCH] Use a CTE for queries involving largs WKB input. Reduces parsing and execution time. git-svn-id: http://svn.osgeo.org/postgis/trunk@8825 b70326c6-7e19-0410-871a-916f4a2858ee --- topology/sql/populate.sql.in.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/topology/sql/populate.sql.in.c b/topology/sql/populate.sql.in.c index dbb1c0d72..830057c37 100644 --- a/topology/sql/populate.sql.in.c +++ b/topology/sql/populate.sql.in.c @@ -759,14 +759,14 @@ BEGIN #endif -- 2. Node to edges and nodes falling within tolerance distance - sql := 'WITH nearby AS ( SELECT geom FROM ' + sql := 'WITH line AS ( SELECT ' + || quote_literal(aline::text) + || '::geometry as g ), nearby AS ( SELECT n.geom FROM ' || quote_ident(atopology) - || '.node WHERE ST_DWithin(geom,' - || quote_literal(aline::text) || '::geometry,' - || tolerance || ') UNION ALL SELECT geom FROM ' + || '.node n, line l WHERE ST_DWithin(n.geom, l.g, ' + || tolerance || ') UNION ALL SELECT e.geom FROM ' || quote_ident(atopology) - || '.edge WHERE ST_DWithin(geom,' - || quote_literal(aline::text) || '::geometry,' + || '.edge e, line l WHERE ST_DWithin(e.geom, l.g, ' || tolerance || ') ) SELECT st_collect(geom) FROM nearby;'; #ifdef POSTGIS_TOPOLOGY_DEBUG RAISE DEBUG '%', sql; -- 2.40.0