[postgis-tickets] [PostGIS] #4671: ST_Length(geography) leaks memory

PostGIS trac at osgeo.org
Wed Apr 22 12:58:32 PDT 2020


#4671: ST_Length(geography) leaks memory
---------------------+---------------------
 Reporter:  komzpa   |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:
Component:  postgis  |    Version:  2.5.x
 Keywords:           |
---------------------+---------------------
 I have a query that splits all the osm roads into two-point segments and
 measures their length. When I do ST_Length(geography) on them, query takes
 up to 300 gigs of RAM and swap. When I replace it with
 {{{ST_Length(ST_Transform(z.seg_geom, 3857))
 *cosd(ST_X(ST_StartPoint(o.geom)))}}}, query fits into expected work_mem.

 {{{
 22:51:24 [gis] > select postgis_full_version();
 ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
 │
 postgis_full_version
 │
 ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 │ POSTGIS="3.1.0alpha1 rf7a3648" [EXTENSION] PGSQL="120"
 GEOS="3.8.0-CAPI-1.13.1 " SFCGAL="1.3.7" PROJ="Rel. 5.2.0, September 15th,
 2018" GDAL="GDAL 2.4.2, released 2019/06/28" LIBXML="2.9.4"
 LIBJSON="0.13.1" LIBPROTOBUF="1.3.1" WAGYU="0.4.3 (Internal)" TOPOLOGY
 RASTER │
 └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
 (1 row)

 Time: 1254,020 ms (00:01,254)
 }}}

 Observed on 3.0 too.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4671>
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