pub enum Provenance {
Show 15 variants
RowCount,
ZoneMap,
NullCount,
Sketch,
FrequencySynopsis,
Quantiles,
Dictionary,
Sortedness,
Distinctness,
LinkHeader,
DegreeDistribution,
Sample,
Default,
Observed,
Propagation,
}Expand description
What produced an answer.
Printed by EXPLAIN next to the class, so these are the words a person reads when a plan went
wrong. It names the source rather than the value, and it is carried by exact answers as well as
by guesses, because an exact count out of a catalog and an exact join cardinality out of a link
header want different follow up questions when one of them turns out to be stale.
The list is spec/stats/02-the-catalogue.md section 2.1.1’s fourteen plus Self::Propagation,
which the specification does not name because it is not a source of data. It is what a number
derived from two others says about itself, and leaving it out would mean a combination inherited
the provenance of whichever operand happened to be on the left.
Variants§
RowCount
A maintained row count. Exact.
ZoneMap
A minimum and a maximum, either answered from or interpolated between.
NullCount
A maintained null count. Exact.
Sketch
A distinct-count sketch.
Carried by both classes, because a bottom-k sketch that has not filled up is holding every
hash it was given and the count it gives back is the count. So this arrives as Exact for a
column with few enough distinct values and Estimated for one with more, and the class is
where that difference is written rather than here.
FrequencySynopsis
A frequency synopsis, with or without its certificate discharged.
Quantiles
A quantile summary.
Dictionary
A dictionary’s size, standing in for or answering a distinct count.
Sortedness
A persisted sortedness flag.
Distinctness
A persisted distinctness flag.
LinkHeader
The four numbers in a relationship’s link header, or a cardinality derived from them. Exact, and the most valuable kind of exact there is, because join cardinality is where every cost model in the literature goes wrong by orders of magnitude.
DegreeDistribution
A relationship’s degree distribution.
Sample
The stored sample.
Default
A constant in the source. The weakest answer that is not Unknown, and the one worth
searching an EXPLAIN for, because it means nobody had a number at that node at all.
Observed
Something a previous execution measured, out of the observation log. Kept apart from every other variant here on purpose: the rest are facts about the file and this one is a fact about history.
Propagation
A rule applied over two other answers. Not a source of data, and the honest thing to say about a number that was derived rather than read.
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub const fn is_observed(self) -> bool
pub const fn is_observed(self) -> bool
Whether this is a fact about a previous execution rather than about the file.
The one question a consumer of spec/stats/06-the-reward.md’s tier 1 corrections has to be
able to ask, because an observation is Exact only for the generation it was taken on.