FileDocCategorySizeDatePackage
QueryStatistics.javaAPI DocHibernate 3.2.52973Fri Jan 27 16:40:32 GMT 2006org.hibernate.stat

QueryStatistics

public class QueryStatistics extends CategorizedStatistics
Query statistics (HQL and SQL) Note that for a cached query, the cache miss is equals to the db count
author
Gavin King

Fields Summary
long
cacheHitCount
long
cacheMissCount
long
cachePutCount
private long
executionCount
private long
executionRowCount
private long
executionAvgTime
private long
executionMaxTime
private long
executionMinTime
Constructors Summary
QueryStatistics(String query)

		super(query);
	
Methods Summary
voidexecuted(long rows, long time)
add statistics report of a DB query

param
rows rows count returned
param
time time taken

		if (time < executionMinTime) executionMinTime = time;
		if (time > executionMaxTime) executionMaxTime = time;
		executionAvgTime = ( executionAvgTime * executionCount + time ) / ( executionCount + 1 );
		executionCount++;
		executionRowCount += rows;
	
public longgetCacheHitCount()
Queries retrieved successfully from the cache

		return cacheHitCount;
	
public longgetCacheMissCount()

		return cacheMissCount;
	
public longgetCachePutCount()

		return cachePutCount;
	
public longgetExecutionAvgTime()
average time in ms taken by the excution of this query onto the DB

		return executionAvgTime;
	
public longgetExecutionCount()
queries executed to the DB

		return executionCount;
	
public longgetExecutionMaxTime()
max time in ms taken by the excution of this query onto the DB

		return executionMaxTime;
	
public longgetExecutionMinTime()
min time in ms taken by the excution of this query onto the DB

		return executionMinTime;
	
public longgetExecutionRowCount()
Number of lines returned by all the executions of this query (from DB) For now, {@link org.hibernate.Query#iterate()} and {@link org.hibernate.Query#scroll()()} do not fill this statistic

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

		return executionRowCount;
	
public java.lang.StringtoString()

		return new StringBuffer()
				.append( "QueryStatistics" )
				.append( "[cacheHitCount=" ).append( this.cacheHitCount )
				.append( ",cacheMissCount=" ).append( this.cacheMissCount )
				.append( ",cachePutCount=" ).append( this.cachePutCount )
				.append( ",executionCount=" ).append( this.executionCount )
				.append( ",executionRowCount=" ).append( this.executionRowCount )
				.append( ",executionAvgTime=" ).append( this.executionAvgTime )
				.append( ",executionMaxTime=" ).append( this.executionMaxTime )
				.append( ",executionMinTime=" ).append( this.executionMinTime )
				.append( ']" )
				.toString();