pub enum PlanWarning {
EstimationMiss,
CartesianProduct,
AllNodesScan,
LabelDisjunctionScan {
indexes: String,
},
}Expand description
One typed warning a plan node carries (ADR-0344, typed node warnings): the vocabulary’s one definition — the wire name it serializes by, the message text that renders beside the affected operator and in the warnings footer, the payload variant that names the property index, and the notification kind it projects to (ADR-0363 decision 1) — each owned here once, beside the notification vocabulary it projects into, so the engine’s detection, the wire parse, and every surface’s rendering cannot drift (LABS-461: one warning type, not three coordinated layers).
The engine constructs the variants at plan-tree construction (the
MATCH-shape detection in relate’s plan_node/warning.rs); the
wire accessor parses the {name, index} maps back into them — the one
typed vocabulary in both directions.
let cartesian = PlanWarning::CartesianProduct;
assert_eq!(cartesian.name(), "CartesianProduct");
assert_eq!(
cartesian.message(),
"the MATCH patterns share no join anchor"
);
// The AllNodesScan warning names no index: a label-less pattern
// cannot use one, so the advice is the label.
let scan = PlanWarning::AllNodesScan;
assert_eq!(scan.name(), "AllNodesScan");
assert_eq!(
scan.message(),
"the scan matches every node; add a label to narrow it"
);
// The label-disjunction scan carries the per-label pairs its own
// predicate wants indexed (LABS-1083).
let disjunction = PlanWarning::LabelDisjunctionScan {
indexes: ":Model(id), :Source(id)".to_string(),
};
assert_eq!(disjunction.name(), "LabelDisjunctionScan");
assert_eq!(
disjunction.message(),
"the disjunction scan answers per label; consider the property index \
(:Model(id), :Source(id))"
);Variants§
EstimationMiss
The operator’s estimate overshot its actual rows by 10x or more —
the same policy the ratio cell’s ! marker reads. PROFILE only:
it needs the actual rows, so it never fires on an EXPLAIN tree.
CartesianProduct
A multi-pattern MATCH whose patterns share no join anchor (no
node variable appears in more than one pattern) — the patterns
multiply instead of joining.
AllNodesScan
A label-less scan (MATCH (n)) while the store carries a property
index. The warning names no index: no property index serves a
pattern without a label, and the one the store carries may be
unrelated to the query, so the advice is the label alone.
LabelDisjunctionScan
A static label disjunction no seek serves (MATCH (p) WHERE p:Model OR p:Source after the planner’s fold, LABS-1083): the
scan answers per disjunct label, never every node — its own
warning shape, never the AllNodesScan text. The warning carries
the per-label :Label(property) pairs its equality predicate
wants indexed, comma-joined, as the suggestion.
Implementations§
Source§impl PlanWarning
impl PlanWarning
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
The warning’s wire name — the one spelling the wire form
serializes (warnings on the node) and
Self::from_wire_parts validates against.
Sourcepub fn suggested_index(&self) -> Option<&str>
pub fn suggested_index(&self) -> Option<&str>
The warning’s index payload — the LabelDisjunctionScan warning’s
per-label index pairs, None on the payload-less variants. The one spelling
of which warnings carry a payload, read by both the message text
and the wire form’s index field, so the vocabulary is matched once.
Sourcepub fn notification_kind(&self) -> NotificationKind
pub fn notification_kind(&self) -> NotificationKind
The notification kind this warning projects to (ADR-0363
decision 1) — from the one exhaustive variant mapping Self::name
reads, so a fourth warning variant must choose its vocabulary row
there rather than falling through a wildcard.
assert_eq!(
PlanWarning::CartesianProduct.notification_kind(),
NotificationKind::CartesianProduct
);
assert!(PlanWarning::EstimationMiss
.notification_kind()
.is_plan_warning());Sourcepub fn message(&self) -> String
pub fn message(&self) -> String
The warning’s message text — the vocabulary’s base text
(Self::vocabulary’s one spelling), with the payload appended in
parentheses when the warning carries one (the LabelDisjunctionScan
warning’s suggested index pairs). The one spelling the engine
renderer and every surface’s table layout render, so the text
cannot drift between the forms.
Trait Implementations§
Source§impl Clone for PlanWarning
impl Clone for PlanWarning
Source§impl Debug for PlanWarning
impl Debug for PlanWarning
impl Eq for PlanWarning
Source§impl PartialEq for PlanWarning
impl PartialEq for PlanWarning
impl StructuralPartialEq for PlanWarning
Auto Trait Implementations§
impl Forget for PlanWarning
impl Freeze for PlanWarning
impl Move for PlanWarning
impl RefUnwindSafe for PlanWarning
impl Send for PlanWarning
impl Sync for PlanWarning
impl Unpin for PlanWarning
impl UnsafeUnpin for PlanWarning
impl UnwindSafe for PlanWarning
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.