<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
</div>
<div>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
Hi</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background: var(--white);">I have question about Postgis Topology and what seems like scaling problem when converting simple feature
</span><span style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background: var(--white);">datasets to Postgis Topology. The code I am testing on is here.</span><br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background: var(--white);"><a href="https://github.com/larsop/resolve-overlap-and-gap/tree/add_postgis_topology_TopoGeo_addLinestring_thred_grid" id="LPNoLP666726">https://github.com/larsop/resolve-overlap-and-gap/tree/add_postgis_topology_TopoGeo_addLinestring_thred_grid</a></span></p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<span style="color: rgb(0, 0, 0); font-size: 12pt; font-family: Arial, Helvetica, sans-serif; line-height: normal;">When working </span><span style="color: rgb(0, 0, 0); font-size: 12pt; font-family: Arial, Helvetica, sans-serif; line-height: normal;">when
 testing a small dataset </span><span style="color: rgb(0, 0, 0); font-size: 12pt; font-family: Arial, Helvetica, sans-serif; line-height: normal;">with 619230 surface (25909671 total line points) it takes around 20 minutes, </span><span style="color: rgb(0, 0, 0); font-size: 13.4399995803833px;"><span style="font-family:Arial,Helvetica,sans-serif; font-size:12pt; line-height:normal"> but
 if go to a dataset that is ten times bigger I get a scaling problem.</span></span><br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<font face="Arial, Helvetica, sans-serif"><font color="#000000"><span style="">Basically</span></font><font color="#000000" size="3"> what I do is that break input datasets into smaller cells by using  a content based grid with around 4000 cells. Then I </font></font><font color="#000000" face="Arial, Helvetica, sans-serif" size="3"><span style="caret-color: rgb(0, 0, 0);">work
 inside each cell where I make sure that no lines are close to the cell border. This seem to scale very good now after resolved the
<a href="https://www.postgresql-archive.org/SubtransControlLock-and-performance-problems-td6123349.html" id="LPlnk342357">
https://www.postgresql-archive.org/SubtransControlLock-and-performance-problems-td6123349.html</a> for each single cell.</span></font></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<font color="#000000" face="Arial, Helvetica, sans-serif" size="3">The scaling problem starts when we start to connect each cell with it's neighbour by adding the missing border lines. I can connect with around one cell pr. second in the start, but after 10 minutes
 it drops to maybe 10 cell pr. minute and later to less than a cell pr minute or less. The CPU load are running on more than 90% there are now no locks or no IO wait on the server. I have tested with analyse on all the involved tables.</font></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">The around 1 meter long border lines below takes from milli seconds and maybe up to minutes  to add.</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">I have the attached a picture where the line I try to add is the red one and where we we also show existing
</span><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">faces, edge_data and nodes close by.</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
</p>
<ul>
<li><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">I have a layer test_topo_ar5 with the following settings.</span><br>
</li></ul>
<p></p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
id | name | srid | precision | hasz</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
------+---------------+------+-----------+------</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
8813 | test_topo_ar5 | 4258 | 1e-06 | f</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
</p>
<ul>
<li><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">It’s a quite big layer and it contains the following numbers</span><br>
</li></ul>
<p></p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
SELECT count(*) from test_topo_ar5.node; 15922351</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
SELECT count(*) from test_topo_ar5.edge_data; 21322652</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
SELECT count(*) from test_topo_ar5.face; 7709431</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
SELECT count(*) from test_topo_ar5.relation ; 0</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
</p>
<ul>
<li><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">In this I add line 47 from a total of 60 lines.</span><br>
</li></ul>
<p></p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
SELECT ST_asText(geo), ST_length(geo,true) from test_topo_ar5.t1 where id = 47;</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
st_astext | st_length</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
-------------------------------------------------------------------------------+-------------------</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
LINESTRING(10.1764246034643 64.1461284736044,10.17644275856 64.1461364736044) | 1.255520004022319</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
(1 row)</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
Time: 2.900 ms</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
</p>
<ul>
<li><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">By doing this call</span><br>
</li></ul>
<p></p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
SELECT topology.TopoGeo_addLinestring('test_topo_ar5',geo,0.000001) from test_topo_ar5.t1 where id = 47;</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
</p>
<ul>
<li><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">When running auto explain I see this in the log.</span><br>
</li></ul>
<p></p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
< postgres, 2020-02-24 11:42:19 CET, resolve_og, 2020-02-24 11:42:19.018 CET >LOG: duration: 13972.041 ms plan:</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
Query Text: SELECT topology.TopoGeo_addLinestring('test_topo_ar5',geo,0.000001) from test_topo_ar5.t1 where id = 47;</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
ProjectSet (cost=0.00..7.76 rows=1000 width=4) (actual time=13972.014..13972.027 rows=3 loops=1)</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
-> Seq Scan on t1 (cost=0.00..2.75 rows=1 width=53) (actual time=0.013..0.020 rows=1 loops=1)</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
Filter: (id = 47)</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
Rows Removed by Filter: 59</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
< postgres, 2020-02-24 11:42:19 CET, resolve_og, 2020-02-24 11:42:19.018 CET >LOG: duration: 14188.079 ms statement: SELECT topology.TopoGeo_addLinestring('test_topo_ar5',geo,0.000001) from test_topo_ar5.t1 where id = 47;</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
</p>
<ul>
<li><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">The output from pg_stat_statements is below, The only strange thing I see here is that the query “SELECT edge_id,geom FROM "test_topo_ar5".edge_data WHERE edge_id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,”
 has </span><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">length of 599090</span><br>
</li></ul>
<p></p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
SELECT</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
(total_time / 1000 / 60) as total,</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
(total_time/calls) as avg,</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
substring(query,1,100), length(query), calls</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
FROM pg_stat_statements</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
ORDER BY 2 DESC</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
LIMIT 100;</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
total | avg | substring | length | calls</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
------------------------+----------------------+------------------------------------------------------------------------------------------------------+--------+-------</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
0.2253887273 | 13523.323638000002 | SELECT topology.TopoGeo_addLinestring($1,geo,$2) from test_topo_ar5.t1 where id = $3 | 84 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
0.00865815 | 519.489 | SELECT edge_id,geom FROM "test_topo_ar5".edge_data WHERE edge_id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10, | 599090 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
0.008164354616666668 | 244.93063850000001 | WITH RECURSIVE edgering AS ( SELECT $1 as signed_edge_id, edge_id, next_left_edge, next_right_edge F | 469 | 2</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
0.00257109955 | 77.1329865 | SELECT +| 133 | 2</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | (total_time / $1 / $2) as total, +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | (total_time/calls) as avg, +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | query +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | FROM pg_stat_stat | |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
7.898863333333334e-05 | 4.739318 | SELECT +| 172 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | (total_time / $1 / $2) as total, +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | (total_time/calls) as avg, +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | substring(query,$3,$4), | |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
7.60238e-05 | 4.561428 | SELECT +| 165 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | (total_time / $1 / $2) as total, +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | (total_time/calls) as avg, +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | substring(query,$3,$4), | |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
0.00010785645000000001 | 3.2356935 | SELECT +| 150 | 2</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | (total_time / $1 / $2) as total, +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | (total_time/calls) as avg, +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | substring(query,$3,$4) +| |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
| | | |</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
3.708345e-05 | 2.225007 | SELECT node_id,geom FROM "test_topo_ar5".node WHERE containing_face IN ($1) AND geom && $2::geometry | 100 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
3.0895216666666665e-05 | 1.8537130000000002 | select pg_stat_statements_reset() | 33 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
1.37987e-05 | 0.827922 | WITH newedges(edge_id,left_face) AS ( VALUES ($1,$2),($3,$4),($5,$6),($7,$8),($9,$10),($11,$12),($13 | 243 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
1.0209283333333334e-05 | 0.612557 | WITH newedges(edge_id,right_face) AS ( VALUES ($1,$2),($3,$4),($5,$6),($7,$8),($9,$10),($11,$12),($1 | 236 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
3.15745e-06 | 0.189447 | SELECT edge_id,left_face,right_face,geom FROM "test_topo_ar5".edge_data WHERE ( left_face = ANY($1) | 142 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
7.9419e-06 | 0.158838 | SELECT node_id,containing_face,geom FROM "test_topo_ar5".node WHERE geom && $1::geometry | 88 | 3</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
4.929566666666667e-06 | 0.147887 | INSERT INTO "test_topo_ar5".edge_data (edge_id,start_node,end_node,left_face,right_face,next_left_ed | 215 | 2</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
2.0770833333333333e-06 | 0.12462500000000001 | SELECT EXISTS ( SELECT $1 FROM "test_topo_ar5".node WHERE ST_Equals(geom, $2::geometry)) | 88 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
1.9927333333333334e-06 | 0.11956399999999999 | INSERT INTO "test_topo_ar5".node (node_id,containing_face,geom) VALUES (DEFAULT,$1,$2::geometry) RET | 114 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
1.9733666666666666e-06 | 0.118402 | SELECT EXISTS ( SELECT $1 FROM "test_topo_ar5".edge_data WHERE ST_Within($2::geometry, geom)) | 93 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
4.6954833333333335e-06 | 0.09390966666666667 | SELECT edge_id,start_node,end_node,left_face,right_face,next_left_edge,next_right_edge,geom FROM "te | 144 | 3</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
7.43605e-06 | 0.0892326 | SELECT edge_id,geom FROM "test_topo_ar5".edge WHERE geom && $1::geometry | 72 | 5</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
1.3167833333333333e-06 | 0.079007 | WITH faces AS ( SELECT face_id FROM "test_topo_ar5".face WHERE mbr && $1 ORDER BY ST_Area(mbr) ASC ) | 200 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
6.3652666666666664e-06 | 0.06365266666666666 | SELECT node_id,geom FROM "test_topo_ar5".node WHERE ST_DWithin(geom, $1::geometry, $2) | 86 | 6</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
8.6195e-07 | 0.051717 | SELECT edge_id,geom FROM "test_topo_ar5".edge_data WHERE edge_id IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10, | 124 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
8.021666666666667e-07 | 0.04813 | UPDATE "test_topo_ar5".node SET containing_face =$1::int WHERE node_id = $2 | 75 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
7.810333333333333e-07 | 0.046862 | SELECT edge_id,geom FROM "test_topo_ar5".edge_data WHERE ST_DWithin($1::geometry, geom, $2) | 91 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
7.368666666666667e-07 | 0.044212 | INSERT INTO "test_topo_ar5".face (face_id,mbr) VALUES (DEFAULT,ST_Envelope($1::geometry)) RETURNING | 107 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
1.1007166666666668e-06 | 0.0330215 | SELECT node_id,containing_face,geom FROM "test_topo_ar5".node WHERE node_id IN ($1,$2) | 86 | 2</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
5.234333333333332e-07 | 0.031405999999999996 | SELECT id,srid,precision,null::geometry FROM topology.topology WHERE name = $1::varchar | 87 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
1.844933333333333e-06 | 0.027673999999999997 | SELECT edge_id,start_node,end_node,left_face,right_face,next_left_edge,next_right_edge,geom FROM "te | 167 | 4</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
7.955833333333334e-07 | 0.0238675 | UPDATE "test_topo_ar5".edge_data SET next_left_edge= $1, abs_next_left_edge= $2 WHERE edge_id = $3 | 98 | 2</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
3.5251666666666666e-07 | 0.021151 | UPDATE "test_topo_ar5".edge_data SET next_right_edge= $1, abs_next_right_edge= $2 WHERE edge_id = $3 | 100 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
2.2806666666666666e-07 | 0.006842 | SELECT nextval($1) | 18 | 2</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
1.7872166666666665e-06 | 0.005957388888888889 | SELECT 1 FROM ONLY "test_topo_ar5"."node" x WHERE "node_id" OPERATOR(pg_catalog.=) $1 FOR KEY SHARE | 104 | 18</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
2.7536166666666677e-06 | 0.005329580645161292 | SELECT 1 FROM ONLY "test_topo_ar5"."face" x WHERE "face_id" OPERATOR(pg_catalog.=) $1 FOR KEY SHARE | 104 | 31</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
3.3149999999999996e-08 | 0.001989 | rollback | 8 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
2.9683333333333334e-08 | 0.001781 | begin | 5 | 1</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
(35 rows)</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
</p>
<ul>
<li><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">I am now running on <span style="background: var(--white);">POSTGIS="2.5.3 r17699" [EXTENSION] PGSQL="120" GEOS="3.8.0-CAPI-1.13.1 " PROJ="Rel. 6.2.1, November 1st, 2019" GDAL="GDAL
</span><span style="background: var(--white);">3.0.4, released 2020/01/28" LIBXML="2.9.1" LIBJSON="0.11" LIBPROTOBUF="1.0.2" TOPOLOGY RASTER, </span><br>
but I have tested PostGIS 3.0 also and the problems seems to be he same. </span></li></ul>
<div><font color="#000000">There is no problem switching back to postgis 3.0, I am using postgis 2.5 on the test server now since we use 2.5 in prod.</font></div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; caret-color: rgb(50, 49, 48)">
<span style="margin: 0px; font-size: 12pt; color: rgb(0, 0, 0); background: var(--white)">I use TopoGeo_AddLineString and not TopoGeo_AddPolygon to avoid to add border lines two times and to make it simple to break up lines  into smaller pieces  when I get
 Topology errors. </span></div>
<div style="margin: 0px; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; caret-color: rgb(50, 49, 48)">
<span style="margin: 0px; font-size: 12pt; color: rgb(0, 0, 0); background: var(--white)"><br>
</span></div>
<div style="margin: 0px; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; caret-color: rgb(50, 49, 48)">
<span style="margin: 0px; font-size: 12pt; color: rgb(0, 0, 0); background: var(--white)">I can switch to use TopoGeo_AddPolygon in some parts if that could solve the problem. </span></div>
<p style="margin-top: 0px; margin-bottom: 0.1in; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 12pt; color: rgb(0, 0, 0); line-height: 19.200000762939453px">
<br>
</p>
</div>
<div><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">Any idea about what do here ?</span><br>
</div>
<div><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);"><br>
</span></div>
<div><span style="color: rgb(0, 0, 0); font-size: 12pt; background: var(--white);">Thanks .</span><br>
</div>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
Lars</p>
<p style="margin-top: 0px; margin-bottom: 0px;color:rgb(0,0,0); font-size:12pt; margin-top:0px; margin-bottom:0.1in; line-height:19.200000762939453px">
<br>
<br>
</p>
<br>
</div>
</body>
</html>