001package com.avaje.ebean.meta;
002
003import java.util.List;
004
005/**
006 * Query execution statistics Meta data.
007 * 
008 * @see MetaInfoManager#collectQueryPlanStatistics(boolean)
009 */
010public interface MetaQueryPlanStatistic {
011
012  /**
013   * Return the bean type this query plan is for.
014   */
015  Class<?> getBeanType();
016
017  /**
018   * Return true if this query plan was tuned by AutoTune.
019   */
020  boolean isAutoTuned();
021
022  /**
023   * Return a string representation of the query plan hash.
024   */
025  String getQueryPlanHash();
026
027  /**
028   * Return the sql executed.
029   */
030  String getSql();
031
032  /**
033   * Return the total number of queries executed.
034   */
035  long getExecutionCount();
036
037  /**
038   * Return the total number of beans loaded by the queries.
039   * <p>
040   * This excludes background fetching.
041   * </p>
042   */
043  long getTotalLoadedBeans();
044
045  /**
046   * Return the total time taken by executions of this query.
047   */
048  long getTotalTimeMicros();
049
050  /**
051   * Return the max execution time for this query.
052   */
053  long getMaxTimeMicros();
054
055  /**
056   * Return the time collection started (or was last reset).
057   */
058  long getCollectionStart();
059
060  /**
061   * Return the time of the last query executed using this plan.
062   */
063  long getLastQueryTime();
064
065  /**
066   * Return the average query execution time in microseconds.
067   * <p>
068   * This excludes background fetching.
069   * </p>
070   */
071  long getAvgTimeMicros();
072
073  /**
074   * Return the average number of bean loaded per query.
075   * <p>
076   * This excludes background fetching.
077   * </p>
078   */
079  long getAvgLoadedBeans();
080
081  /**
082   * Return the 'origin' points and paths that resulted in the query being
083   * executed and the associated number of times the query was executed via that
084   * path.
085   * <p>
086   * This includes direct and lazy loading paths.
087   * </p>
088   */
089  List<MetaQueryPlanOriginCount> getOrigins();
090
091}