Using Hibernate ORM with Hikari CP in AWS RDS using RDS Proxy and Aurora-PostgreSQL and I need to prevent DEALLOCATE ALL statement from being executed on every transaction. Is there a way to prevent the ORM from running deallocate all? It is preventing PostgreSQL from using the prepared statement cache, so every transaction goes through the process of planning the query, where if we were not running deallocate all we could retain the prepared statements existing plans. The tables are well indexed for the queries so query planning is much more expensive that the query itself and is adding between 1 and 2 orders of magnitude to the latency.
Hibernate ORM doesn’t do that. It’s most probably the JDBC driver that is doing this. Better ask here