java.lang.Object
io.ebeaninternal.server.query.CQueryPlan
- All Implemented Interfaces:
SpiQueryPlan
Represents a query for a given SQL statement.
This can be executed multiple times with different bind parameters.
That is, the sql including the where clause, order by clause etc must be exactly the same to share the same query plan with the only difference being bind values.
This is useful in that is common in OLTP type applications that the same query will be executed quite a lot just with different bind values. With this query plan we can bypass some of the query statement generation (for performance) and collect statistics on the number and average execution times. This is turn can be used to identify queries that could be looked at for performance tuning.
-
Method Summary
Modifier and TypeMethodDescriptionfinal Class<?> beanType()The related entity bean typecreateDataReader(boolean unmodifiable, ResultSet rset) final io.ebeaninternal.server.query.DQueryPlanOutputcreateMeta(String bind, String planString) Return as Database query plan.final Stringhash()The hash of the sql.final booleanReturn true if there are no statistics collected since the last reset.final booleanisRawSql()final Stringlabel()final longReturn the time this query plan was last used.final Stringlocation()final Stringname()The plan name.final ProfileLocationThe related profile location.final voidqueryPlanInit(long thresholdMicros) Initiate bind capture with the give threshold.final voidReset the query statistics.final Stringsql()The SQL for the query plan.toString()final io.ebeaninternal.server.query.CQueryPlanStats.Snapshotvisit(MetricVisitor visitor) Return a copy of the current query statistics.
-
Method Details
-
toString
-
beanType
Description copied from interface:SpiQueryPlanThe related entity bean type- Specified by:
beanTypein interfaceSpiQueryPlan
-
name
Description copied from interface:SpiQueryPlanThe plan name.- Specified by:
namein interfaceSpiQueryPlan
-
hash
Description copied from interface:SpiQueryPlanThe hash of the sql.- Specified by:
hashin interfaceSpiQueryPlan
-
sql
Description copied from interface:SpiQueryPlanThe SQL for the query plan.- Specified by:
sqlin interfaceSpiQueryPlan
-
profileLocation
Description copied from interface:SpiQueryPlanThe related profile location.- Specified by:
profileLocationin interfaceSpiQueryPlan
-
label
-
dependentTables
-
location
-
queryPlanInit
public final void queryPlanInit(long thresholdMicros) Description copied from interface:SpiQueryPlanInitiate bind capture with the give threshold.- Specified by:
queryPlanInitin interfaceSpiQueryPlan
-
createMeta
public final io.ebeaninternal.server.query.DQueryPlanOutput createMeta(String bind, String planString) Description copied from interface:SpiQueryPlanReturn as Database query plan.- Specified by:
createMetain interfaceSpiQueryPlan- Parameters:
bind- Description of the bind values usedplanString- The raw database query plan
-
createDataReader
-
isRawSql
public final boolean isRawSql() -
resetStatistics
public final void resetStatistics()Reset the query statistics. -
visit
Return a copy of the current query statistics. -
lastQueryTime
public final long lastQueryTime()Return the time this query plan was last used. -
isEmptyStats
public final boolean isEmptyStats()Return true if there are no statistics collected since the last reset.
-