<p></p>
<p dir="auto">I have no idea if this is actually a (micro) optimization worth pursuing, but I noticed in the <a href="https://www.postgresql.org/docs/current/populate.html#POPULATE-COPY-FROM" rel="nofollow">PostgreSQL help topic related to COPY</a> the following statement related to WAL and COPY:</p>
<blockquote>
<p dir="auto">COPY <strong>is fastest</strong> when used within the same transaction as an earlier CREATE TABLE or TRUNCATE command. In such cases no WAL needs to be written, because in case of an error, the files containing the newly loaded data will be removed anyway. However, this consideration only applies when <a href="https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-WAL-LEVEL" rel="nofollow">wal_level</a> is minimal as all commands must write WAL otherwise.</p>
</blockquote>
<p dir="auto">Of course, this is not a general improvement given the constraints, but I still wonder if there might be value for osm2pgsql putting the COPY statement in the same transaction as the CREATE TABLE as suggested here for the loading of nodes, ways an relations in case of initial imports?</p>
<p dir="auto">Anyway, I have no idea how much WAL influences performance these days with NVMe SSDs abounding, it might be an old remark in the PostgreSQL Help dating from the time of HDD RAIDs only.</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/discussions/1991">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353SWP62EK46TFHPCMGTXO4NNTANCNFSM6AAAAAA2A5QMYU">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AA6353QWAEO2ZESAWAFWWBDXO4NNTA5CNFSM6AAAAAA2A5QMYWWGG33NNVSW45C7OR4XAZNKIRUXGY3VONZWS33OVJRW63LNMVXHIX3JMTHAAUQHWY.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/repo-discussions/1991</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/discussions/1991",
"url": "https://github.com/openstreetmap/osm2pgsql/discussions/1991",
"name": "View Discussion"
},
"description": "View this Discussion on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>