Interface QueryPlanner
-
- All Known Implementing Classes:
CascadesPlanner
,RecordQueryPlanner
@API(STABLE) public interface QueryPlanner
A common interface for classes that can plan aRecordQuery
into aRecordQueryPlan
. The common interface allows tests to be run against several planners.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
QueryPlanner.IndexScanPreference
Preference between index scan and record scan.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RecordMetaData
getRecordMetaData()
Get theRecordMetaData
for this planner.RecordStoreState
getRecordStoreState()
Get theRecordStoreState
for this planner.RecordQueryPlan
plan(RecordQuery query)
Create a plan to get the results of the provided query.QueryPlanResult
planQuery(RecordQuery query)
Create a plan to get the results of the provided query.void
setIndexScanPreference(QueryPlanner.IndexScanPreference indexScanPreference)
Set whetherRecordQueryIndexPlan
is preferred overRecordQueryScanPlan
even when it does not satisfy any additional conditions.
-
-
-
Method Detail
-
plan
@Nonnull RecordQueryPlan plan(@Nonnull RecordQuery query)
Create a plan to get the results of the provided query.- Parameters:
query
- a query for records on this planner's metadata- Returns:
- a plan that will return the results of the provided query when executed
- Throws:
RecordCoreException
- if the planner cannot plan the query
-
planQuery
@Nonnull QueryPlanResult planQuery(@Nonnull RecordQuery query)
Create a plan to get the results of the provided query. This method returns aQueryPlanResult
that contains the same plan as returned byplan(RecordQuery)
with additional information provided in theQueryPlanInfo
- Parameters:
query
- a query for records on this planner's metadata- Returns:
- a
QueryPlanResult
that contains the plan for the query with additional information - Throws:
RecordCoreException
- if the planner cannot plan the query
-
getRecordMetaData
@Nonnull RecordMetaData getRecordMetaData()
Get theRecordMetaData
for this planner.- Returns:
- the meta-data
-
getRecordStoreState
@Nonnull RecordStoreState getRecordStoreState()
Get theRecordStoreState
for this planner.- Returns:
- the record store state
-
setIndexScanPreference
void setIndexScanPreference(@Nonnull QueryPlanner.IndexScanPreference indexScanPreference)
Set whetherRecordQueryIndexPlan
is preferred overRecordQueryScanPlan
even when it does not satisfy any additional conditions. Scanning without an index is more efficient, but will have to skip over unrelated record types. For that reason, it is safer to use an index, except when there is only one record type. If the meta-data has more than one record type but the record store does not, this can be overridden.- Parameters:
indexScanPreference
- whether to prefer index scan over record scan
-
-