ST_AsMVTGeom: skipping wagyu for polygons it would leave alone

John Carmack johncarmack at me.com
Sat Oct 10 08:28:11 PDT 2026


Hi all,

I contribute to Martin, MapLibre's tile server, and found this benchmarking PostGIS tile servers.

ST_AsMVTGeom sends every polygon through wagyu, even when wagyu will hand it back unchanged. On dense building tiles that's most of the database's CPU. I've opened a patch that finds those rings with exact integer tests and writes them the way wagyu would, so the output stays identical byte for byte. Everything else still goes to wagyu.

On Berlin's buildings it makes Martin's tile query 2.45x faster on a dense z14 tile and 2.44x on random z14 tiles, 1.65x at z16 and 1.12x at z18.

On GH-647 Paul wrote that "maintaining valid outputs from MVT processing is just as important as performance." This only skips wagyu when it can prove what wagyu would return: 40,276,961 rings from Berlin, random rings and exhaustive small grids all came out identical. The pull request has the details.

Ticket: https://trac.osgeo.org/postgis/ticket/6145
Pull request: https://github.com/postgis/postgis/pull/1182

It's for 3.8. I'd appreciate a review whenever you have time.

Thanks!
John


More information about the postgis-devel mailing list