@API(value=STABLE) public class RecordQueryPlanner extends Object implements QueryPlanner
RecordQuery
to a RecordQueryPlan
.
The plan can use secondary indexes defined in a RecordMetaData
to execute the query efficiently.Modifier and Type | Class and Description |
---|---|
protected static class |
RecordQueryPlanner.ScoredPlan |
QueryPlanner.IndexScanPreference
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_COMPLEXITY_THRESHOLD
A limit on the complexity of the plans generated by the planner.
|
Constructor and Description |
---|
RecordQueryPlanner(RecordMetaData metaData,
RecordStoreState recordStoreState) |
RecordQueryPlanner(RecordMetaData metaData,
RecordStoreState recordStoreState,
PlannableIndexTypes indexTypes,
StoreTimer timer) |
RecordQueryPlanner(RecordMetaData metaData,
RecordStoreState recordStoreState,
PlannableIndexTypes indexTypes,
StoreTimer timer,
int complexityThreshold) |
RecordQueryPlanner(RecordMetaData metaData,
RecordStoreState recordStoreState,
StoreTimer timer) |
RecordQueryPlanner(RecordMetaData metaData,
RecordStoreState recordStoreState,
StoreTimer timer,
int complexityThreshold) |
Modifier and Type | Method and Description |
---|---|
QueryPlanner.IndexScanPreference |
getIndexScanPreference()
Get whether
RecordQueryIndexPlan is preferred over RecordQueryScanPlan even when it does not
satisfy any additional conditions. |
RecordQueryPlan |
plan(RecordQuery query)
Create a plan to get the results of the provided query.
|
RecordQueryPlan |
planCoveringAggregateIndex(RecordQuery query,
String indexName) |
void |
setIndexScanPreference(QueryPlanner.IndexScanPreference indexScanPreference)
Set whether
RecordQueryIndexPlan is preferred over RecordQueryScanPlan even when it does not
satisfy any additional conditions. |
public static final int DEFAULT_COMPLEXITY_THRESHOLD
RecordQueryPlan.getComplexity()
for a description of plan complexity.public RecordQueryPlanner(@Nonnull RecordMetaData metaData, @Nonnull RecordStoreState recordStoreState)
public RecordQueryPlanner(@Nonnull RecordMetaData metaData, @Nonnull RecordStoreState recordStoreState, @Nullable StoreTimer timer)
public RecordQueryPlanner(@Nonnull RecordMetaData metaData, @Nonnull RecordStoreState recordStoreState, @Nonnull PlannableIndexTypes indexTypes, @Nullable StoreTimer timer)
public RecordQueryPlanner(@Nonnull RecordMetaData metaData, @Nonnull RecordStoreState recordStoreState, @Nullable StoreTimer timer, int complexityThreshold)
public RecordQueryPlanner(@Nonnull RecordMetaData metaData, @Nonnull RecordStoreState recordStoreState, @Nonnull PlannableIndexTypes indexTypes, @Nullable StoreTimer timer, int complexityThreshold)
@Nonnull public QueryPlanner.IndexScanPreference getIndexScanPreference()
RecordQueryIndexPlan
is preferred over RecordQueryScanPlan
even when it does not
satisfy any additional conditions.public void setIndexScanPreference(@Nonnull QueryPlanner.IndexScanPreference indexScanPreference)
RecordQueryIndexPlan
is preferred over RecordQueryScanPlan
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.setIndexScanPreference
in interface QueryPlanner
indexScanPreference
- whether to prefer index scan over record scan@Nonnull public RecordQueryPlan plan(@Nonnull RecordQuery query)
plan
in interface QueryPlanner
query
- a query for records on this planner's metadataRecordCoreException
- if there is no index that matches the sort in the provided query@Nullable public RecordQueryPlan planCoveringAggregateIndex(@Nonnull RecordQuery query, @Nonnull String indexName)