Closed larsop closed 2 years ago
After
create index on test_ar5_2022_01.edge_data(abs_next_left_edge); create index on test_ar5_2022_01.edge_data(abs_next_right_edge);
We that the update is down from 21855.71064431967 ms to 0.15098291893603538
LIMIT 100;
total | avg | calls | substring
----------------------+---------------------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------
0.003973367149999998 | 0.15098291893603538 | 1579 | UPDATE "test_ar5_2022_01".edge_data SET next_left_edge= $1, abs_next_left_edge= $2 WHERE next_left_edge= $3 AND abs_next_left_edge= $4
(2 rows)
I believe you're hitting https://trac.osgeo.org/postgis/ticket/2083 Do you confirm your "clean up a simple feature" is basically using ST_RemEdgeModFace ?
The problem with indices is that while the speed up reads they also slow down updates, so when to create the indices might be a user choice, depending on use case. This is just to say that we need to profile the effects of the index on both writes and reads.
I switched from ST_RemEdgeModFace to ST_RemEdgeNewFace that was more robust to related invalid faces in some cases.
We now created Postgis Topology with
6552124 (1 row)
17258641 (1 row)
In less than 24 hours.
I will rerun the test about with this indexes in place to check how it works
What do you mean by "invalid faces" ? All those function have an undefined behavior if the underlying topology is invalid
HINT: you can get info about the size of topologies (count of faces, edges, nodes) with:
SELECT TopologySummary('test_ar5_2022_01')
HINT: you can get info about the size of topologies (count of faces, edges, nodes) with:
SELECT TopologySummary('test_ar5_2022_01')
Thanks forgot that one, SELECT TopologySummary('test_ar5_2022_01');
topologysummary
------------------------------------------------------------------------
Topology test_ar5_2022_01 (id 108272, SRID 4258, precision 1e-05) +
11975736 nodes, 17258641 edges, 6552123 faces, 0 topogeoms in 0 layers+
For the record: ST_CreateTopoGeo time is not visibly degraded by adding those indices. The test is for a much smaller topology:
strk=# select TopologySummary('wsa_ws_svw_polygon_topology_test');
topologysummary
------------------------------------------------------------------------
Topology wsa_ws_svw_polygon_topology_test (id 49, SRID 0, precision 0)+
19754 nodes, 29453 edges, 10978 faces, 0 topogeoms in 0 layers +
ST_CreateTopoGeo takes:
Time: 237719.810 ms (03:57.720) -- with indices on abs_next_left_edge and abs_next_right_edge columns of edge_data Time: 235180.206 ms (03:55.180) -- without those indices
Did a new test running in 14 hours so the indexes seems not cause any new performance problems.
topologysummary
------------------------------------------------------------------------
Topology test_ar5_2022_01 (id 2814, SRID 4258, precision 1e-05) +
15176059 nodes, 21364105 edges, 9242564 faces, 0 topogeoms in 0 layers+
What do you mean by "invalid faces" ? All those function have an undefined behavior if the underlying topology is invalid
I think it failed when casting to simple feature from a TopoGeometry and it just seemed worker better when I used create new face as far as I can remember.
Any bug like that would be useful to file upstream, if underlying topology was valid..
When clean up a simple feature with 17296735 in edge_data we find performance issue
Will try to add these indexes