[Tile-serving] [osm2pgsql-dev/osm2pgsql] Practices to handle tile expiration (Discussion #2495)

Paul Norman notifications at github.com
Wed Jul 8 22:09:41 UTC 2026


> And I imagine small things like footpaths change in many places all the time, which is why so many tiles at zoom levels <= 9 keep getting expired that my server can barely keep up with it.

This is correct. Any changes in a table will cause expiry of tiles for the objects changed. osm2pgsql doesn't know that some objects aren't used on some zoom ranges because of SQL in later stages of your processing.

> * Is there a technical reason why I cannot define the expire minzoom in the `:insert()` call instead of defining a fixed minzoom for the expire table? That would make my setup much easier, since I would be able to keep using a single way table and a single expire table.

This would be fairly easy to do for insert but would break when objects are deleted.

> I found out that I can configure a [`minzoom`](https://osm2pgsql.org/doc/manual.html#defining-and-using-expire-outputs) option for an expire table. Because I can only define it for the whole table, it means that I basically need one expire table per minimum zoom level.

This is not correct. You'll generally have one table with roads shown on low zooms (e.g. motorway and trunk), one table with roads shown on medium zooms (e.g. motorway to secondary), and one table with roads shown on high zooms (e.g. everything). This is also a significant performance boost to low-zoom rendering. It's also easier to step from this into using osm2pgsql generalization.

Or you can go the way of the OSMF servers and just re-render low zooms nightly.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2495#discussioncomment-17577997
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/repo-discussions/2495/comments/17577997 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20260708/6f3e96d9/attachment.htm>


More information about the Tile-serving mailing list