[postgis-tickets] [PostGIS] #3437: ST_Intersects incorrect for MultiPoints

PostGIS trac at osgeo.org
Fri Jun 21 03:40:09 PDT 2019


#3437: ST_Intersects incorrect for MultiPoints
-----------------------+--------------------------
  Reporter:  dbaston   |      Owner:  dbaston
      Type:  defect    |     Status:  new
  Priority:  critical  |  Milestone:  PostGIS GEOS
 Component:  postgis   |    Version:  2.2.x
Resolution:            |   Keywords:
-----------------------+--------------------------

Comment (by Algunenano):

 > After GEOS 3.6 is released, consider re-enabling PreparedIntersects? for
 Points/MultiPoints? if there is a performance benefit.

 I've just tested it:

 Current trunk:
 {{{
 template_postgis=# WITH
 a AS (SELECT ST_Collect(ST_MakePoint(random(), random())) as geom from
 generate_series(1, 1000)),
 b AS (SELECT (ST_Dump(geom)).geom FROM a)
 SELECT count(*) FROM b INNER JOIN a ON ST_Intersects(a.geom, b.geom);
  count
 -------
   1000
 (1 row)

 Time: 2366.630 ms (00:02.367)
 template_postgis=# WITH
 a AS (SELECT ST_Collect(ST_MakePoint(random(), random())) as geom from
 generate_series(1, 1000)),
 b AS (SELECT (ST_Dump(geom)).geom FROM a)
 SELECT count(*) FROM b INNER JOIN a ON ST_Intersects(a.geom, b.geom);
  count
 -------
   1000
 (1 row)

 Time: 2355.091 ms (00:02.355)
 template_postgis=# WITH
 a AS (SELECT ST_Collect(ST_MakePoint(random(), random())) as geom from
 generate_series(1, 1000)),
 b AS (SELECT (ST_Dump(geom)).geom FROM a)
 SELECT count(*) FROM b INNER JOIN a ON ST_Intersects(a.geom, b.geom);
  count
 -------
   1000
 (1 row)

 Time: 2344.796 ms (00:02.345)
 }}}


 Removing the patch since GEOS 3.6 is now the minimum requirement:
 {{{
 template_postgis=# WITH
 a AS (SELECT ST_Collect(ST_MakePoint(random(), random())) as geom from
 generate_series(1, 1000)),
 b AS (SELECT (ST_Dump(geom)).geom FROM a)
 SELECT count(*) FROM b INNER JOIN a ON ST_Intersects(a.geom, b.geom);
  count
 -------
   1000
 (1 row)

 Time: 89.477 ms
 template_postgis=# WITH
 a AS (SELECT ST_Collect(ST_MakePoint(random(), random())) as geom from
 generate_series(1, 1000)),
 b AS (SELECT (ST_Dump(geom)).geom FROM a)
 SELECT count(*) FROM b INNER JOIN a ON ST_Intersects(a.geom, b.geom);
  count
 -------
   1000
 (1 row)

 Time: 81.209 ms
 template_postgis=# WITH
 a AS (SELECT ST_Collect(ST_MakePoint(random(), random())) as geom from
 generate_series(1, 1000)),
 b AS (SELECT (ST_Dump(geom)).geom FROM a)
 SELECT count(*) FROM b INNER JOIN a ON ST_Intersects(a.geom, b.geom);
  count
 -------
   1000
 (1 row)

 Time: 78.410 ms
 template_postgis=# WITH
 a AS (SELECT ST_Collect(ST_MakePoint(random(), random())) as geom from
 generate_series(1, 1000)),
 b AS (SELECT (ST_Dump(geom)).geom FROM a)
 SELECT count(*) FROM b INNER JOIN a ON ST_Intersects(a.geom, b.geom);
  count
 -------
   1000
 (1 row)

 Time: 82.055 ms
 }}}


 It's a nice 30x that we have there. I'll remove it now :D

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3437#comment:6>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list