Opened 3 years ago

Closed 3 years ago

#4952 closed enhancement (fixed)

Speed up ring building in ValidateTopology

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 3.2.0
Component: topology Version:
Keywords: Cc:

Description

The most expensive step in topology validation at the moment is building all rings.

In a topology with 20557 rings the current code on my machine takes 114 seconds to compute them all.

Current code makes 20577 iterations of a loop, and each iteration performs an INSERT and a DELETE statement, among other things.

Change History (3)

comment:1 by strk, 3 years ago

Additional operation in each iteration is the actual build of ring.

Temptative improvement (computing all rings in a single statement):

https://gitlab.com/postgis/postgis/-/merge_requests/45

comment:2 by strk, 3 years ago

New attempt looks promising: https://gitlab.com/postgis/postgis/-/merge_requests/46 Builds all rings in 25 seconds rather than 114 seconds

comment:3 by Sandro Santilli <strk@…>, 3 years ago

Resolution: fixed
Status: newclosed

In 406ecaa/git:

ValidateTopology: build all rings in a single statement

Closes #4952

Implements GetRingEdges internally, to avoid the subtransaction
while still surviving non-closed rings.

In real world case it reduces the cost of building 20356 rings
from ~100 seconds to ~20 seconds

Note: See TracTickets for help on using tickets.