BUG #16183: PREPARED STATEMENT slowed down by jit

PG Bug reporting form <[email protected]> Thu, 02 Jan 2020 10:48:17 +0000
Newsgroups gmane.comp.db.postgresql.bugs
Message-ID <[email protected]>
The following bug has been logged on the website:

Bug reference:      16183
Logged by:          Christian Quest
Email address:      [email protected]
PostgreSQL version: 12.1
Operating system:   Ubuntu 18.04
Description:        

I'm running several OpenStreetMap map rendering servers. They are all based
on PG/postgis.
After an upgrade from v10 to 12, the usual update process took 10x more time
than it used to.

After digging a few days, it appear that the default jit=on is the cause.

The update tool (osm2pgsql) makes heavy use of PREPARED statements. Could
there be a bug in jit+PREPARED causing the statement to be recompiled on
each execute ?

The other side of the issue is described here:
https://github.com/openstreetmap/osm2pgsql/issues/1045