Skip to content

Enable prepared statement caching by default for PostgreSQL/MySQL/MariaDB/DB2 #50010

@yrodiere

Description

@yrodiere

Description

quarkus.datasource.reactive.cache-prepared-statement defaults to false, because it's only supported for some databases.

This creates a performance disadvantage for reactive compared to JDBC for databases that do support caching prepared statement; e.g. the PostgreSQL JDBC driver caches prepared statements by default (preparedStatementCacheQueries defaults to 256), and @franz1981 tells us this has a sizeable impact on benchmarks.

We should:

  • Make cachePreparedStatements an Optional<Boolean>.
  • Remove @WithDefault from that field.
  • Add @ConfigDocDefault to explain what the default is: true if supported (PostgreSQL/MySQL/MariaDB/DB2), false otherwise.
  • Handle the default with a Optional#orElse in relevant places, i.e. where the DB-specific code forwards the setting.
  • Test, at least manually, that the default is effective.

Implementation ideas

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions