Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set plan_cache_mode to force_custom_plan in my application?

I have a Spring Boot application with a REST service. I'm using PorstgreSQL as my database with TimescaleDB. I'm trying to set plan_cache_mode to force_custom_plan because I don't want it to switch to generic plan. I'm using Hikari to manage the datasource. How do I set it in the HikariDataSource?

like image 752
TheStranger Avatar asked Oct 22 '25 23:10

TheStranger


1 Answers

You can set the parameter on the database or user level:

CREATE ROLE|DATABASE somename SET plan_cache_mode = force_custom_plan;

Then all new connections as that user or to that database get that setting.

like image 126
Laurenz Albe Avatar answered Oct 25 '25 15:10

Laurenz Albe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!