I would like to use osm2pgsql to load the europe.osm.pbf to the database. I've already read about the optimalization to make the osm2pgsql do it as fast as possible. However, there's one option, that I really don't understand, which is --flat-nodes <flat nodes>.
What is this file? Where is it located?

1 Answer 1


The flat nodes file is just a temporary file generated by the osm2pgsql program during import, so it isn't "located" anywhere. Instead, the --flat-nodes <flat nodes> input parameter, allows you to specify the location and filename where osm2pgsql should create this temporary file. Note that for Geofabrik's Europe extract, the generated flat nodes file is close to 50 GB, so make sure you have the disk space to accommodate this when specifying the location.

The flat nodes file is used to store all the nodes of the PBF file (>4.8 billion for current planet extract) to be imported, instead of storing all this temporary information in PostgreSQL. As it is optimized for this purpose, it is more efficient in terms of storage requirement.

As it needs to access this file a lot, setting the location to some form of fast (NVMe) SSD is probably highly beneficial.

osm2pgsql manual pages: https://osm2pgsql.org/doc/manual.html

  • Very good explanation, this solved my slow speed problem, the node import went from 192k/s up to 3000k/s
    – Bim
    Apr 30 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.