[Tile-serving] [osm2pgsql-dev/osm2pgsql] Add grouped-linemerge generalization (PR #2482)

leijurv notifications at github.com
Mon Jun 1 20:39:44 UTC 2026


leijurv left a comment (osm2pgsql-dev/osm2pgsql#2482)

That's great to hear that it's interesting!!!

I've fixed the clang-tidy, and I've fixed a performance mistake.

Here are some numbers for what this does, and how long it takes, over downtown Los Angeles.

Note that in practice, we would never expire an entire tile at Z13. More likely Z18 or Z19. I'm just showing it for clarity.

Note that the most relevant column is probably `walk`, which is how long the CTE takes. Note that even in a nasty torture test, a large region of los angeles, that made the CTE go to a recursion depth of 433, the time it took is very small, 0.08 seconds in the worst case. I think this is a really good sign - but - I don't actually know what the performance requirements are here. Roughly, fetching all the ways in the affected tile, took about as long as the recursion (at higher zooms), so hopefully that's fine?

As we get to higher zooms, the reason why `region` doesn't get faster, is the issue I mentioned earlier. The GiST index on a linestring indexes the entire bbox. Therefore, even at "zoom level infinity" (looking up a single point), the GiST will unavoidably give you every way whose entire bbox covers that point (`way && point`), and then Postgres will then filter it down to ST_Intersects or whatever the query actually was. So, by the time we get to Z17 or Z18, it's almost like we are querying a single point, but there are tons of ways in a dense urban area whose full min-to-max bbox covers that point.

| zoom          | seed ways | ways traversed | nodes | CTE recursion depth | groups | output geoms | region | walk | collect | delete | insert |  total |
|---------------|-----------|----------------|-------|-----------|--------|--------------|--------|------|---------|--------|--------|--------|
| z13           |     1,793 |          3,792 | 4,430 |       433 |    450 |          783 |     38ms |   81ms |      39ms |     28ms |     49ms | 234 ms |
| z14           |       616 |          1,855 | 2,014 |       433 |    135 |          212 |     29ms |   46ms |      23ms |     17ms |     18ms | 133 ms |
| z15           |       171 |            410 |   452 |        89 |     44 |           60 |     30ms |   20ms |       8ms |      6ms |      9ms |  74 ms |
| z16           |        50 |            185 |   200 |        38 |     17 |           25 |     30ms |   17ms |      10ms |      5ms |      4ms |  67 ms |
| z17           |        15 |            152 |   161 |        38 |      9 |           11 |     28ms |   18ms |      11ms |      5ms |      4ms |  66 ms |
| z18           |         5 |             88 |    92 |        38 |      4 |            6 |     29ms |   16ms |       6ms |      7ms |      4ms |  61 ms |
| z19           |         4 |             88 |    92 |        38 |      4 |            6 |     31ms |   16ms |       6ms |      7ms |      4ms |  63 ms |
| z20           |         2 |             58 |    60 |        38 |      2 |            2 |     30ms |   17ms |       9ms |      5ms |      3ms |  64 ms |



-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2482#issuecomment-4596331192
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/pull/2482/c4596331192 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20260601/5b331bfb/attachment.htm>


More information about the Tile-serving mailing list