Enable logging of slow database operations

We consider db operations slower than 10s for now.

Fixes #38863

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>
This commit is contained in:
Thomas Darimont
2025-04-14 19:53:38 +02:00
committed by GitHub
parent efd879f3d9
commit 716eaab487
2 changed files with 14 additions and 0 deletions

View File

@@ -124,6 +124,17 @@
MSSQL returns the whole result at once.
See https://docs.oracle.com/en/database/oracle/oracle-database/21/jjdbc/resultset.html -->
<property name="hibernate.jdbc.fetch_size" value="64" />
<!-- We consider database statements taking longer than 10s as slow
See https://docs.jboss.org/hibernate/orm/6.6/introduction/html_single/Hibernate_Introduction.html#slow-queries
Note, that this requires the logger configuration: org.hibernate.SQL_SLOW:info
-->
<property name="hibernate.log_slow_query" value="10000"/>
<!-- Prepends the name or query text of the executed statement as comment to make it easier to identify slow queries
See https://docs.jboss.org/hibernate/orm/6.6/introduction/html_single/Hibernate_Introduction.html#slow-queries
-->
<property name="hibernate.use_sql_comments" value="true"/>
</properties>
</persistence-unit>
</persistence>

View File

@@ -30,6 +30,9 @@ quarkus.log.category."io.quarkus.arc.processor.IndexClassLookupUtils".level=off
quarkus.log.category."io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor".level=warn
quarkus.log.category."io.quarkus.deployment.steps.ReflectiveHierarchyStep".level=error
# Enable logging for slow queries
quarkus.log.category."org.hibernate.SQL_SLOW".level=info
quarkus.transaction-manager.enable-recovery=true
# Set default directory name for the location of the transaction logs
quarkus.transaction-manager.object-store.directory=${kc.home.dir:default}${file.separator}data${file.separator}transaction-logs