I have already loaded osm data into postgresql earlier. Now I want to update the database. I have downloaded the pbf file from geofabrik. How I can update the database without deleting the existing Tables?

1 Answer 1


If you have imported a planet or extract some time ago and have now downloaded a (much) newer planet or extract:

It does not really make sense to do any updating as I think calculating and applying the diff will not save you time. Just re-run osm2pgsql again and it will remove the tables and create new ones resulting in updated data.

If you want to keep your data updated continuously:

Download diff files provided by different providers (e.g. Geofabrik), see Planet.osm/diffs for more information. Then use e.g. Osmosis in combination with osm2pgsql --append. Switch2OSM with section "Updating" might also provide hints.

  • I have tried but it returns Processing: Node(82248k 663.3k/s) Way(4383k 8.56k/s) Relation(0 0.00/s)Killed Apr 27, 2016 at 10:33
  • 1
    So it did not read the relations and did not even reach the writing stage. Did it not read anything for a while and you stopped it or did it exit by itself? Could it be a memory issue? Which extract are you trying to import? Could you try with a smaller extract first?
    – nebulon42
    Apr 27, 2016 at 12:04
  • "Did it not read anything for a while and you stopped it " Happenned. Database were parged. Now no table exist. I am in great trouble Apr 27, 2016 at 17:59
  • WHat about updating using flat nodes files? I have not the temp tables in my database but I kept the flat nodes files. Do I need to download the entire PBF file again or just the diff file? Consider it is a fresh install.
    – Magno C
    Apr 5, 2017 at 11:17

Your Answer

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

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