I came across HikariCP
and I was amazed by the benchmarks and I wanted to try it instead of my default choice C3P0
and to my surprise I struggled to get the configurations
right probably because the configurations differ based on what combination of tech stack you are using.
I have setup Spring Boot
project with JPA, Web, Security
starters (Using [Spring Initializer][1]) to use PostgreSQL
as a database with HikariCP
as connection pooling.
I have used Gradle
as build tool and I would like to share what worked for me for the following assumptions:
- Spring Boot Starter JPA (Web & Security - optional)
- Gradle build tool
- PostgreSQL running and setup with a database (i.e. schema, user, db)
This gist is related to SO post https://stackoverflow.com/questions/26490967/how-do-i-configure-hikaricp-in-my-spring-boot-app-in-my-application-properties-f
I cant figure out how to set the defaultRowFetchSize in the application.properties. Can you help with that? Thanks!
https://jdbc.postgresql.org/documentation/head/connect.html
defaultRowFetchSize = int
Determine the number of rows fetched in ResultSet by one fetch with trip to the database. Limiting the number of rows are fetch with each trip to the database allow avoids unnecessary memory consumption and as a consequence OutOfMemoryException.
The default is zero, meaning that in ResultSet will be fetch all rows at once. Negative number is not available.