Skip to main content

Class: JoinIndices

Defined in: packages/core/src/optimizer/rules/join-indices.ts:29

Finds join conditions that match an existing index and replaces them with plan.ProjectionConcat and plan.Selection operators, that could be further optimized by the IndexScans rule.

Implements​

Constructors​

Constructor​

new JoinIndices(db): JoinIndices

Defined in: packages/core/src/optimizer/rules/join-indices.ts:41

Parameters​

ParameterTypeDescription
dbDortDBAsFriendInternal database interface.

Returns​

JoinIndices

Properties​

db​

protected db: DortDBAsFriend

Defined in: packages/core/src/optimizer/rules/join-indices.ts:43

Internal database interface.


operator​

operator: typeof Join = plan.Join

Defined in: packages/core/src/optimizer/rules/join-indices.ts:33

The operator this rule starts matching at.

Implementation of​

PatternRule.operator


renameCheckerVmap​

protected renameCheckerVmap: Record<string, AttributeRenameChecker>

Defined in: packages/core/src/optimizer/rules/join-indices.ts:39

Per-language attribute-rename-checker visitor instances.


renamerVmap​

protected renamerVmap: Record<string, AttributeRenamer>

Defined in: packages/core/src/optimizer/rules/join-indices.ts:37

Per-language attribute-renamer visitor instances.


tdepsVmap​

protected tdepsVmap: Record<string, TransitiveDependencies>

Defined in: packages/core/src/optimizer/rules/join-indices.ts:35

Per-language transitive-dependency visitor instances.

Methods​

findValidAttrs()​

protected findValidAttrs(projections): IdSet

Defined in: packages/core/src/optimizer/rules/join-indices.ts:158

Filters out computed attributes from projections.

Parameters​

ParameterType
projectionsProjection[]

Returns​

IdSet


getExprCandidates()​

protected getExprCandidates(conditions, schema): [number, number][]

Defined in: packages/core/src/optimizer/rules/join-indices.ts:176

Get expressions to match against the index.

Parameters​

ParameterTypeDescription
conditionsCalculation[]conditions to check
schemaIdSetschema of the side which we are checking against

Returns​

[number, number][]

array of pairs [condition index, condition original FnCall argument index]


match()​

match(node): PatternRuleMatchResult<JoinIndicesBindings>

Defined in: packages/core/src/optimizer/rules/join-indices.ts:52

Matches the given plan operator against this rule.

Parameters​

ParameterTypeDescription
nodeJoinThe plan operator to match.

Returns​

PatternRuleMatchResult<JoinIndicesBindings>

Implementation of​

PatternRule.match


matchIndex()​

protected matchIndex(index, candidates, conditions, renameMap): number[]

Defined in: packages/core/src/optimizer/rules/join-indices.ts:121

Returns the matched candidate indices if index can satisfy any of them, handling OR alternatives; null otherwise.

Parameters​

ParameterType
indexIndex
candidates[number, number][]
conditionsCalculation[]
renameMapRenameMap

Returns​

number[]


prepareRenameMap()​

protected prepareRenameMap(projections): RenameMap

Defined in: packages/core/src/optimizer/rules/join-indices.ts:107

Composes the inverse rename maps of all chained projections into a single map, or returns null if there are none.

Parameters​

ParameterType
projectionsProjection[]

Returns​

RenameMap


transform()​

transform(node, bindings): PlanOperator

Defined in: packages/core/src/optimizer/rules/join-indices.ts:238

Transforms the given plan operator using the provided bindings.

Parameters​

ParameterTypeDescription
nodeJoinThe plan operator to transform.
bindingsJoinIndicesBindingsThe bindings to use for the transformation.

Returns​

PlanOperator

Implementation of​

PatternRule.transform


traverseSide()​

protected traverseSide(node): object

Defined in: packages/core/src/optimizer/rules/join-indices.ts:200

Walks down one side of a join through projections/selections/order-by to find the underlying source; returns null if the side is not index-eligible.

Parameters​

ParameterType
nodePlanOperator

Returns​

projections​

projections: Projection[]

Projection operators encountered while descending, in top-down order.

source​

source: TupleSource | ItemSource

The underlying tuple or item source at the bottom of the chain.