Opened 5 years ago

Closed 5 years ago

#4450 closed enhancement (fixed)

Speed up ST_GeometryType by avoiding strncat calls

Reported by: Algunenano Owned by: Algunenano
Priority: medium Milestone: PostGIS 3.0.0
Component: postgis Version: master
Keywords: Cc:

Description

ST_GeometryType is currently doing 2 strncat calls which aren't necessary since the output is always the same and can be stored statically.

Performance difference:

Select ST_GeometryType(the_geom_webmercator) from benchmark_7773a711c8441d4b494a51fd9feebeac7a9b9c734619398620293;

Before:

number of transactions actually processed: 407
latency average = 296.925 ms
tps = 13.471411 (including connections establishing)
tps = 13.474553 (excluding connections establishing)

Using a static char:

number of transactions actually processed: 437
latency average = 275.895 ms
tps = 14.498272 (including connections establishing)
tps = 14.501781 (excluding connections establishing)

10% ain't much, but it's honest work

Change History (2)

comment:2 by algunenano, 5 years ago

Resolution: fixed
Status: assignedclosed

In 17586:

Speed up ST_GeometryType

Closes https://github.com/postgis/postgis/pull/434
Closes #4450

Note: See TracTickets for help on using tickets.