Top Description Fields Constructors Methods
org.hibernate.stat.internal

public Class QueryStatisticsImpl

extends Object
implements QueryStatistics
Class Inheritance
All Implemented Interfaces
org.hibernate.stat.QueryStatistics, java.io.Serializable
Imports
java.util.concurrent.atomic.AtomicLong, .LongAdder, java.util.concurrent.locks.Lock, .ReadWriteLock, .ReentrantReadWriteLock, org.hibernate.query.Query, org.hibernate.stat.QueryStatistics

Query statistics (HQL and SQL)

Note that for a cached query, the cache miss is equals to the db count

Author
Alex Snaps

Field Summary

Modifier and TypeField and Description
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder
private final AtomicLong
private final AtomicLong
private final LongAdder
private final LongAdder
private final LongAdder
private final AtomicLong
private final String
private final Lock
private final AtomicLong
private final Lock

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
compiled(long
time taken
microseconds
)

add plan statistics report of a DB query

public void
executed(long
rows count returned
rows
,
long
time taken
time
)

add statistics report of a DB query

public long
getCacheHitCount()

Implements org.hibernate.stat.QueryStatistics.getCacheHitCount.

Queries retrieved successfully from the cache
public long
getCacheMissCount()

Implements org.hibernate.stat.QueryStatistics.getCacheMissCount.

The number of cache misses for this query
public long
getCachePutCount()

Implements org.hibernate.stat.QueryStatistics.getCachePutCount.

The number of cache puts for this query
public long
getExecutionAvgTime()

Implements org.hibernate.stat.QueryStatistics.getExecutionAvgTime.

average time in ms taken by the execution of this query onto the DB
public double
getExecutionAvgTimeAsDouble()

Implements org.hibernate.stat.QueryStatistics.getExecutionAvgTimeAsDouble.

average time in ms as double taken by the execution of this query onto the DB
public long
public long
getExecutionMaxTime()

Implements org.hibernate.stat.QueryStatistics.getExecutionMaxTime.

max time in ms taken by the execution of this query onto the DB
public long
getExecutionMinTime()

Implements org.hibernate.stat.QueryStatistics.getExecutionMinTime.

min time in ms taken by the execution of this query onto the DB
public long

Returns:

The number of rows cumulatively returned by the given query; stream and scroll queries do not effect this total as their number of returned rows is not known at execution time.
getExecutionRowCount
()

Implements org.hibernate.stat.QueryStatistics.getExecutionRowCount.

Number of lines returned by all the executions of this query (from DB) For now, Query#stream()} and Query#scroll() do not fill this statistic
public long
getExecutionTotalTime()

Implements org.hibernate.stat.QueryStatistics.getExecutionTotalTime.

total time in ms taken by the execution of this query onto the DB
public long
getPlanCacheHitCount()

Overrides default org.hibernate.stat.QueryStatistics.getPlanCacheHitCount.

Query plan successfully fetched from the cache
public long
getPlanCacheMissCount()

Overrides default org.hibernate.stat.QueryStatistics.getPlanCacheMissCount.

Query plan not fetched from the cache
public long
pack-priv void
pack-priv void
pack-priv void
pack-priv void
pack-priv void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cacheHitCountback to summary
private final LongAdder cacheHitCount
cacheMissCountback to summary
private final LongAdder cacheMissCount
cachePutCountback to summary
private final LongAdder cachePutCount
executionCountback to summary
private final LongAdder executionCount
executionMaxTimeback to summary
private final AtomicLong executionMaxTime
executionMinTimeback to summary
private final AtomicLong executionMinTime
executionRowCountback to summary
private final LongAdder executionRowCount
planCacheHitCountback to summary
private final LongAdder planCacheHitCount
planCacheMissCountback to summary
private final LongAdder planCacheMissCount
planCompilationTotalMicrosecondsback to summary
private final AtomicLong planCompilationTotalMicroseconds
queryback to summary
private final String query
readLockback to summary
private final Lock readLock
totalExecutionTimeback to summary
private final AtomicLong totalExecutionTime
writeLockback to summary
private final Lock writeLock

Constructor Detail

QueryStatisticsImplback to summary
public QueryStatisticsImpl(String query)

Method Detail

compiledback to summary
pack-priv void compiled(long microseconds)

add plan statistics report of a DB query

Parameters
microseconds:long

time taken

executedback to summary
public void executed(long rows, long time)

add statistics report of a DB query

Parameters
rows:long

rows count returned

time:long

time taken

getCacheHitCountback to summary
public long getCacheHitCount()

Implements org.hibernate.stat.QueryStatistics.getCacheHitCount.

Queries retrieved successfully from the cache

getCacheMissCountback to summary
public long getCacheMissCount()

Implements org.hibernate.stat.QueryStatistics.getCacheMissCount.

Doc from org.hibernate.stat.QueryStatistics.getCacheMissCount.

The number of cache misses for this query

getCachePutCountback to summary
public long getCachePutCount()

Implements org.hibernate.stat.QueryStatistics.getCachePutCount.

Doc from org.hibernate.stat.QueryStatistics.getCachePutCount.

The number of cache puts for this query

getExecutionAvgTimeback to summary
public long getExecutionAvgTime()

Implements org.hibernate.stat.QueryStatistics.getExecutionAvgTime.

average time in ms taken by the execution of this query onto the DB

getExecutionAvgTimeAsDoubleback to summary
public double getExecutionAvgTimeAsDouble()

Implements org.hibernate.stat.QueryStatistics.getExecutionAvgTimeAsDouble.

average time in ms as double taken by the execution of this query onto the DB

getExecutionCountback to summary
public long getExecutionCount()

Implements org.hibernate.stat.QueryStatistics.getExecutionCount.

queries executed to the DB

getExecutionMaxTimeback to summary
public long getExecutionMaxTime()

Implements org.hibernate.stat.QueryStatistics.getExecutionMaxTime.

max time in ms taken by the execution of this query onto the DB

getExecutionMinTimeback to summary
public long getExecutionMinTime()

Implements org.hibernate.stat.QueryStatistics.getExecutionMinTime.

min time in ms taken by the execution of this query onto the DB

getExecutionRowCountback to summary
public long getExecutionRowCount()

Implements org.hibernate.stat.QueryStatistics.getExecutionRowCount.

Number of lines returned by all the executions of this query (from DB) For now, Query#stream()} and Query#scroll() do not fill this statistic

Returns:long

The number of rows cumulatively returned by the given query; stream and scroll queries do not effect this total as their number of returned rows is not known at execution time.

getExecutionTotalTimeback to summary
public long getExecutionTotalTime()

Implements org.hibernate.stat.QueryStatistics.getExecutionTotalTime.

total time in ms taken by the execution of this query onto the DB

getPlanCacheHitCountback to summary
public long getPlanCacheHitCount()

Overrides default org.hibernate.stat.QueryStatistics.getPlanCacheHitCount.

Query plan successfully fetched from the cache

getPlanCacheMissCountback to summary
public long getPlanCacheMissCount()

Overrides default org.hibernate.stat.QueryStatistics.getPlanCacheMissCount.

Query plan not fetched from the cache

getPlanCompilationTotalMicrosecondsback to summary
public long getPlanCompilationTotalMicroseconds()

Overrides default org.hibernate.stat.QueryStatistics.getPlanCompilationTotalMicroseconds.

Query plan overall compiled total

incrementCacheHitCountback to summary
pack-priv void incrementCacheHitCount()
incrementCacheMissCountback to summary
pack-priv void incrementCacheMissCount()
incrementCachePutCountback to summary
pack-priv void incrementCachePutCount()
incrementPlanCacheHitCountback to summary
pack-priv void incrementPlanCacheHitCount()
incrementPlanCacheMissCountback to summary
pack-priv void incrementPlanCacheMissCount()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.