[postgis-tickets] r17554 - Use GEOSPrepare also for Points and Multipoints

Raul raul at rmr.ninja
Fri Jun 21 03:49:32 PDT 2019


Author: algunenano
Date: 2019-06-21 03:49:32 -0700 (Fri, 21 Jun 2019)
New Revision: 17554

Modified:
   trunk/NEWS
   trunk/postgis/lwgeom_geos_prepared.c
Log:
Use GEOSPrepare also for Points and Multipoints

This was removed waiting for a fix that was introduced
in GEOS 3.6, which is now the minimum required version.

Basic tests show this makes ST_Intersects with cached
points 30x faster.

Closes #3437


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2019-06-20 16:28:41 UTC (rev 17553)
+++ trunk/NEWS	2019-06-21 10:49:32 UTC (rev 17554)
@@ -15,6 +15,7 @@
   - #4406, Throw on invalid characters when decoding geohash (Raúl Marín)
   - #4429, Avoid resource leaks with PROJ6 (Raúl Marín)
   - #4372, PROJ6: Speed improvements (Raúl Marín)
+  - #3437, Speed up ST_Intesects with Points (Raúl Marín)
 
 PostGIS 3.0.0alpha2
 2019/06/02

Modified: trunk/postgis/lwgeom_geos_prepared.c
===================================================================
--- trunk/postgis/lwgeom_geos_prepared.c	2019-06-20 16:28:41 UTC (rev 17553)
+++ trunk/postgis/lwgeom_geos_prepared.c	2019-06-21 10:49:32 UTC (rev 17554)
@@ -350,16 +350,6 @@
 		return LW_FAILURE;
     }
 
-	/*
-	 * Avoid creating a PreparedPoint around a Point or a MultiPoint.
-	 * Consider changing this behavior in the future if supported GEOS
-	 * versions correctly handle prepared points and multipoints and
-	 * provide a performance benefit.
-	 * See https://trac.osgeo.org/postgis/ticket/3437
-	 */
-	if (lwgeom_get_type(lwgeom) == POINTTYPE || lwgeom_get_type(lwgeom) == MULTIPOINTTYPE)
-		return LW_FAILURE;
-
 	prepcache->geom = LWGEOM2GEOS( lwgeom , 0);
 	if ( ! prepcache->geom ) return LW_FAILURE;
 	prepcache->prepared_geom = GEOSPrepare( prepcache->geom );



More information about the postgis-tickets mailing list