pub struct PlannedSource {
pub cost: f64,
pub rows: f64,
pub id: usize,
pub table: TableInfo,
pub alias: Vec<u8>,
pub path: AccessPath,
pub join: JoinKind,
pub on: Option<BoundExpr>,
pub on_enforced: bool,
}Expand description
One FROM term with the path chosen for it.
Fields§
§cost: f64What the planner estimated this term’s path would cost.
It is kept so that a test can assert on the reason a plan was chosen rather than only on the plan, which is the difference between catching a cost-model regression and catching it two releases later.
rows: f64How many rows the path is estimated to produce.
id: usizeThe statement-wide number every bound expression refers to it by.
table: TableInfoThe table.
alias: Vec<u8>The name the query calls it.
path: AccessPathHow its rows are produced.
join: JoinKindThe join that attached it to the term before it.
on: Option<BoundExpr>The ON condition, when the join is an outer one.
An inner join’s condition is an ordinary predicate and is distributed with the rest; an outer join’s is not, because a row that fails it is still emitted, null-extended. Keeping it here rather than in the residual list is what stops the two being confused.
on_enforced: boolWhether the path this term is read by enforces the whole ON condition.
What decides whether an outer join can be an index nested loop.
That operator probes the inner tree by a key and
null-extends when the probe finds nothing; it has nowhere to test a
condition the key did not capture, so it may only be used when there is
nothing left to test. When the key is the whole condition - which
ON b.k = a.k over an index on b(k) is - the probe’s answer and the
condition’s answer are the same answer.
False for every inner join, where the condition is distributed into the statement’s terms and re-tested as a residual, and false for an outer join whose condition says more than its key does.