Table of Contents

Struct ExecutionPlan

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

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

primaryFieldIndex int

Sets PrimaryFieldIndex: -1 to scan the PK index, >= 0 to scan a secondary index.

primaryKeyType KeyType

Sets PrimaryKeyType: key type of the primary secondary index (valid only when primaryFieldIndex >= 0).

scanMin long

Sets PrimaryScanMin: inclusive lower bound of the primary scan range.

scanMax long

Sets PrimaryScanMax: inclusive upper bound of the primary scan range.

descending bool

Sets Descending: iterate the primary stream in descending order.

orderedEvaluators FieldEvaluator[]

Sets OrderedEvaluators: filters ordered most-selective first.

estimatedCounts long[]

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

bool

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

FieldEvaluator[]

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

int

PrimaryKeyType

Key type of the primary secondary index. Only valid when PrimaryFieldIndex >= 0.

public readonly KeyType PrimaryKeyType

Field Value

KeyType

PrimaryScanMax

Upper bound (inclusive) for the primary scan range (PK-encoded or field-value-encoded).

public readonly long PrimaryScanMax

Field Value

long

PrimaryScanMin

Lower bound (inclusive) for the primary scan range (PK-encoded or field-value-encoded).

public readonly long PrimaryScanMin

Field Value

long

Properties

UsesSecondaryIndex

True when the primary stream uses a secondary index (not PK scan).

public bool UsesSecondaryIndex { get; }

Property Value

bool

Methods

ToString()

Returns a human-readable description of the primary scan and its ordered filter chain (for diagnostics).

public override string ToString()

Returns

string