This chapter describes the various operations the Nominatim database administrator may use to clean and maintain the database. None of these operations is mandatory but they may help improve the performance and accuracy of results.
Updating postcodes
Command: nominatim refresh --postcodes
Postcode centroids (aka 'calculated postcodes') are generated by looking at all postcodes of a country, grouping them and calculating the geometric centroid. There is currently no logic to deal with extreme outliers (typos or other mistakes in OSM data). There is also no check if a postcodes adheres to a country's format, e.g. if Swiss postcodes are 4 digits.
When running regular updates, postcodes results can be improved by running this command on a regular basis. Note that only the postcode table and the postcode search terms are updated. The postcode that is assigned to each place is only updated when the place is updated.
The command takes around 70min to run on the planet and needs ca. 40GB of temporary disk space.
Updating word counts
Command: nominatim refresh --word-counts
Nominatim keeps frequency statistics about all search terms it indexes. These
statistics are currently used to optimise queries to the database. Thus better
statistics mean better performance. Word counts are created once after import
and are usually sufficient even when running regular updates. You might want
to rerun the statistics computation when adding larger amounts of new data,
for example, when adding an additional country via nominatim add-data
.
Removing large deleted objects
Nominatim refuses to delete very large areas because often these deletions are
accidental and are reverted within hours. Instead the deletions are logged in
the import_polygon_delete
table and left to the administrator to clean up.
There is currently no command to do that. You can use the following SQL query to force a deletion on all objects that have been deleted more than a certain timespan ago (here: 1 month):
SELECT place_force_delete(p.place_id) FROM import_polygon_delete d, placex p
WHERE p.osm_type = d.osm_type and p.osm_id = d.osm_id
and age(p.indexed_date) > '1 month'::interval