Delete entities on a per-tile basis
To avoid the lengthy SQL DELETE
statement at the beginning of the Finalizer operation, entities should be deleted on a per-tile basis. Currently, the DELETE
statement at the beginning removes all entities of the country being processed. This statement can take a long time and also slows down other processes. Furthermore, it may prevent auto-vacuums of the database to run. The preferred solution is to delete all entities of a tile before the tile is filled up again with new entities. This will cause more queries but avoid the large initial one. It also helps reducing problems with Rabotnik processes running in parallel and writing entities to the country.