<p></p>
<h2 dir="auto">What version of osm2pgsql are you using?</h2>
<p dir="auto">1.8.1-101-geaff0924</p>
<h2 dir="auto">What operating system and PostgreSQL/PostGIS version are you using?</h2>
<p dir="auto">2023-07-07 10:38:52 Database version: 15.3 (Ubuntu 15.3-1.pgdg22.04+1)<br>
2023-07-07 10:38:52 PostGIS version: 3.3</p>
<h2 dir="auto">Tell us something about your system</h2>
<p dir="auto">Bare metal 512 GB RAM, 2x22 Intel Xeon E5-2699 v4</p>
<h2 dir="auto">What did you do exactly?</h2>
<p dir="auto">I've been testing some different command line options for osm2pgsql using the Geofabrik 'Liechtenstein' extract. Now I know that some of the options here do not make sense for such a tiny extract, <em>like specifying a flat-nodes file</em>, as the flat-nodes file is supposed to be only used on very large extracts or Planet, but they should technically work.</p>
<p dir="auto">In fact, <em>they all do work</em> in the sense that the processing will successfully finish for all command lines listed below, but I noticed an unexpected anomaly when specifying the <strong>--flat-nodes</strong> option: Not only is the processing much slower and extended to > 5 minutes instead of under 15 seconds without <strong>--flat-nodes</strong>, but during the node loading stage of the osm2pgsql processing, I see the specified flat nodes file grow to an unexpectedly large and seemingly anomalous size of <strong>87.4 GB</strong> max.</p>
<p dir="auto">I understand from the documentation and discussions I have seen before that the specific format of the flat nodes file is not really suited for processing small extracts, but this seems anomalous, the 'Liechtenstein' extract PBF is just 2.8 MB. Or is this expected behavior and a mere consequence of the specific flat nodes implementation?</p>
<p dir="auto"><strong>These command works, import within 15 seconds or less:</strong></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --create -W -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --tablespace-slim-data 'osm_e' --tablespace-slim-index 'osm_i' --create -W --slim -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --tablespace-slim-data 'osm_e' --tablespace-slim-index 'osm_i' --create -W --slim -C 1000 -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --tablespace-slim-data 'osm_e' --tablespace-slim-index 'osm_i' --create -W --slim --drop -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --tablespace-slim-data 'osm_e' --tablespace-slim-index 'osm_i' --create -W --slim --drop -C 1000 -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<p dir="auto"><strong>These commands "fail", import > 5 minutes, flat-nodes file of 87.4 GB(!) created:</strong></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --tablespace-slim-data 'osm_e' --tablespace-slim-index 'osm_i' --create -W --slim --flat-nodes 'data/nodes_micro.bin' -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --tablespace-slim-data 'osm_e' --tablespace-slim-index 'osm_i' --create -W --slim --flat-nodes 'data/nodes_micro.bin' -C 1000 -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --tablespace-slim-data 'osm_e' --tablespace-slim-index 'osm_i' --create -W --slim --drop --flat-nodes 'data/nodes_micro.bin' -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<p dir="auto"><code class="notranslate">osm2pgsql -O flex -d micro -U osm --tablespace-slim-data 'osm_e' --tablespace-slim-index 'osm_i' --create -W --slim --drop --flat-nodes 'data/nodes_micro.bin' -C 1000 -S 'osm2pgsql/flex-config/openstreetmap-carto.lua' 'data/liechtenstein-latest.osm.pbf'</code></p>
<h2 dir="auto">What did you expect to happen?</h2>
<p dir="auto">Using the <strong>--flat-nodes</strong> option may be sub-optimal and slower, but is not expected to result in a flat nodes file massively larger than the corresponding PBF file being imported.</p>
<h2 dir="auto">What did happen instead?</h2>
<p dir="auto">Seemingly anomalous big flat nodes file of 87.4 GB created.</p>
<h2 dir="auto">What did you do to try analyzing the problem?</h2>
<p dir="auto">Tried different command line options like <strong>--slim</strong>, <strong>--drop</strong> and <strong>-C</strong> to exclude these options were involved in the issue. Only the --flat-nodes setting seems to cause the issue.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/issues/1992">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353XAHSCSCEL7ELR23KLXPA4YFANCNFSM6AAAAAA2CBPLUY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AA6353VYKODPN45YKDFP4G3XPA4YFA5CNFSM6AAAAAA2CBPLU2WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHGV273IE.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/osm2pgsql/issues/1992</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/issues/1992",
"url": "https://github.com/openstreetmap/osm2pgsql/issues/1992",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>