<p></p>
<p>I tried running osm2pgsql with your config on a planet file and it took about 10 hours. On the same machine a "normal" import without any stage-2-processing will need about 8 hours. So this is inside the range of what I would expect. Also the <code>DELETE FROM "public"."osm_lines" WHERE way_id IN</code> type queries seem to use the index as expected.</p>
<p>You could try to debug this using <a href="https://www.postgresql.org/docs/current/auto-explain.html" rel="nofollow">auto_explain</a> to check what queries are run and whether they use the index.</p>
<p>You have to be a bit careful with the content of <code>pg_stat_activity</code>. This can contain queries that have been run and are not actually running any more. Add <code>WHERE state == 'active'</code> to see what PostgreSQL is actually doing at the moment. So I believe it could be some other query that is the problem.</p>
<p>I see you are using <code>--cache 32000</code>. That's 32 GB of cache. This is quite a lot and unless you really have a lot of RAM (>64 GB at least) this might not leave enough RAM for kernel buffers and the database. That's why we usually recommend setting <code>--cache 0</code> when a flat node file is in use.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/issues/1436#issuecomment-808701553">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353UU24POU4RXTZLJDGLTFWQLJANCNFSM4ZZHGTSQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353R2UWYJBHIVCY4KDFDTFWQLJA5CNFSM4ZZHGTS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGAZ444I.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/issues/1436#issuecomment-808701553",
"url": "https://github.com/openstreetmap/osm2pgsql/issues/1436#issuecomment-808701553",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>