Search code examples
connection-poolingspring-jdbchikaricp

What are these cache HikariCP datasource properties


HikariCP's documentation provides these properties, namely cachePrepStmts, prepStmtCacheSize and prepStmtCacheSqlLimit. But I was unable to find anywhere what they exactly mean and what are the units of the last 2 properties. Their names give some hint that they are associated with caching and prepare statements but I am still confused.

What exactly does prepStmtCacheSize mean and what is the unit for 250? Is it KB or MB or something else? And absolutely no clue on what does prepStmtCacheSqlLimit mean and again what is the unit of 2048?

enter image description here


Solution

  • This are specific MySQL Configuration

    prepStmtCacheSize This sets the number of prepared statements that the MySQL driver will cache per connection. The default is a conservative 25. We recommend setting this to between 250-500.

    prepStmtCacheSqlLimit This is the maximum length of a prepared SQL statement that the driver will cache. The MySQL default is 256. In our experience, especially with ORM frameworks like Hibernate, this default is well below the threshold of generated statement lengths. Our recommended setting is 2048.