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?
Asked
Active
Viewed 822 times
1 Answers
3
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.

Laurenz Albe
- 209,280
- 17
- 206
- 263
-
1I would rather set it in the application instead of in the database, because it's only specific endpoints that I want to apply this to. – TheStranger Apr 28 '22 at 11:06
-
2Then run the `SET` whenever you open a database connection. – Laurenz Albe Apr 28 '22 at 12:02