Struct ExecutionPlan
Describes the primary scan stream and selectivity-ordered filter chain for a query. Built by Typhon.Engine.Internals.PlanBuilder, consumed by Typhon.Engine.Internals.PipelineExecutor.
public readonly struct ExecutionPlan
- Inherited Members
Remarks
The primary stream scans either the PK index (PrimaryFieldIndex == -1) or a secondary index (PrimaryFieldIndex >= 0). When a secondary index is selected (unique or AllowMultiple), entity PKs are recovered via Typhon.Engine.CompRevStorageHeader.EntityPK. The planner selects the most selective index to minimize the number of entities scanned.
Constructors
ExecutionPlan(int, KeyType, long, long, bool, FieldEvaluator[], long[])
Builds an execution plan describing the primary scan stream and its selectivity-ordered filter chain.
public ExecutionPlan(int primaryFieldIndex, KeyType primaryKeyType, long scanMin, long scanMax, bool descending, FieldEvaluator[] orderedEvaluators, long[] estimatedCounts)
Parameters
primaryFieldIndexintSets PrimaryFieldIndex: -1 to scan the PK index, >= 0 to scan a secondary index.
primaryKeyTypeKeyTypeSets PrimaryKeyType: key type of the primary secondary index (valid only when
primaryFieldIndex>= 0).scanMinlongSets PrimaryScanMin: inclusive lower bound of the primary scan range.
scanMaxlongSets PrimaryScanMax: inclusive upper bound of the primary scan range.
descendingboolSets Descending: iterate the primary stream in descending order.
orderedEvaluatorsFieldEvaluator[]Sets OrderedEvaluators: filters ordered most-selective first.
estimatedCountslong[]Sets EstimatedCounts: estimated cardinality per evaluator (parallel to
orderedEvaluators).
Fields
Descending
True when the primary stream should iterate in descending order.
public readonly bool Descending
Field Value
EstimatedCounts
Estimated cardinality per evaluator (parallel array, same order).
public readonly long[] EstimatedCounts
Field Value
- long[]
OrderedEvaluators
Field evaluators ordered by ascending estimated cardinality (most selective first). Evaluated via component reads with short-circuit on first failure.
public readonly FieldEvaluator[] OrderedEvaluators
Field Value
PrimaryFieldIndex
Index into Typhon.Engine.ComponentTable.IndexedFieldInfos for the primary scan stream. -1 means scan the PK index (full table scan with filter evaluation).
= 0 means scan a secondary index with a narrowed key range.
public readonly int PrimaryFieldIndex
Field Value
PrimaryKeyType
Key type of the primary secondary index. Only valid when PrimaryFieldIndex >= 0.
public readonly KeyType PrimaryKeyType
Field Value
PrimaryScanMax
Upper bound (inclusive) for the primary scan range (PK-encoded or field-value-encoded).
public readonly long PrimaryScanMax
Field Value
PrimaryScanMin
Lower bound (inclusive) for the primary scan range (PK-encoded or field-value-encoded).
public readonly long PrimaryScanMin
Field Value
Properties
UsesSecondaryIndex
True when the primary stream uses a secondary index (not PK scan).
public bool UsesSecondaryIndex { get; }
Property Value
Methods
ToString()
Returns a human-readable description of the primary scan and its ordered filter chain (for diagnostics).
public override string ToString()