Opened 9 years ago

Closed 9 years ago

#3570 closed enhancement (fixed)

Reduce memory usage in ST_ClusterWithin / ST_ClusterDBSCAN

Reported by: dbaston Owned by: dbaston
Priority: medium Milestone: PostGIS 2.3.0
Component: postgis Version: 2.2.x
Keywords: Cc:

Description

The make_strtree function in lwgeom_geos_cluster.c prepares a GEOS STRTree of LWGEOM pointers. To store the LWGEOMs in the STRTree, it has to provide GEOSSTRtree_insert with a GEOS geometry whose envelope corresponds to the envelope of the LWGEOM. It's currently doing this with GBOX2GEOS, which produces a rectangular GEOS Polygon. Since this geometry is never used directly — it's basically a container for an envelope — this should be replaced with either a GEOS Point or a two-point GEOS LineString, depending on the LWGEOM that's being stored in the tree.

This will reduce a significant memory overhead, particularly when clustering functions are used on point data sets.

Change History (1)

comment:1 by dbaston, 9 years ago

Resolution: fixed
Status: newclosed

Committed to trunk at r14979. When clustering points, these changes reduce peak memory usage by ~45%. Run time is also improved.

Note: See TracTickets for help on using tickets.