Skip to main content

Module plan

Module plan 

Source
Expand description

The logical and physical plans.

Invariant: a physical plan is legal before it is fast. Every access path this planner produces returns exactly the rows a full scan of the same term would return, and every predicate a path consumes is either fully enforced by the path or left in the residual filter. A predicate that is neither is a wrong answer, so the two lists are built together and the compiler emits whatever is left over.

The phase-6 planner is deliberately minimal: FROM terms stay in written order, joins are nested loops, and the only paths are a full scan, a rowid lookup or range, and an index seek over an equality prefix with an optional range on the column after it. Cost is not modelled yet; a path is chosen because it is more selective by construction, not because a number said so.

Structs§

IndexSeekBranch
One seek over an index, as a branch of an AccessPath::IndexSeekUnion.
Levers
Which planner optimizations are switched on.
PhysicalPlan
A physical plan for a read-only statement.
PlannedSource
One FROM term with the path chosen for it.
RangeBound
One end of a scan range.
VirtualChoice
What a module answered when it was shown the offer.
VirtualConstraint
One predicate offered to a module, with what it was made of.

Enums§

AccessPath
How one FROM term’s rows are produced.
AggregationMode
How the rows are grouped and aggregated.
BoundKind
A comparison an access path can enforce.

Constants§

ROWID_ENTRY_SLOT
The entry slot that stands for the row’s own key rather than a field.

Functions§

conjunction
Splits a predicate into the conjunction the offer is built from.
expression_holds_subquery
Returns whether an expression holds a subquery, anywhere beneath it.
is_outer
Returns whether a join keeps rows that match nothing on the other side.
plan_select_with
Plans a bound SELECT with some optimizations switched off.
split_conjunction
Splits a AND b AND c into its terms.
unanswerable_index_hint
Returns the name of an INDEXED BY index that cannot answer its term.
write_path_with
Returns how an UPDATE or a DELETE should find the rows it touches, with some optimizations switched off. @param table - the table being written @param source_id - the source the filter’s columns are bound to @param filter - the WHERE clause, when there is one @param levers - which optimizations are on