Hibernate statistics logging a query execution time

Viewed 265

I have setup hibernate logging statistics to get the query execution time and number of rows returned (e.g. HQL: Select p From Product p, time: 0ms, rows: 10) If the database is on a different server to the application, does the execution time include network transport latency or is it just the time executing the query on the database ? Thanks.

1 Answers

Although it's not clear from the documentation, checking the invocations of org.hibernate.stat.spi.StatisticsImplementor#queryExecuted it becomes clear that they measure execution time on the application level (using System.nanoTime()) rather than pulling this information from the database. Based on this I think it is safe to assume that the network latency is included in the execution time.

Related