#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum KernelRungWire {
Chain { hops: i64 },
FrontierNfa,
Walker,
}
impl KernelRungWire {
pub const CHAIN: &'static str = "chain";
pub const FRONTIER_NFA: &'static str = "frontier-nfa";
pub const WALKER: &'static str = "walker";
pub const NAMES: [&'static str; 3] = [Self::CHAIN, Self::FRONTIER_NFA, Self::WALKER];
pub const fn as_str(self) -> &'static str {
match self {
KernelRungWire::Chain { .. } => Self::CHAIN,
KernelRungWire::FrontierNfa => Self::FRONTIER_NFA,
KernelRungWire::Walker => Self::WALKER,
}
}
pub const fn hops(self) -> Option<i64> {
match self {
KernelRungWire::Chain { hops } => Some(hops),
KernelRungWire::FrontierNfa | KernelRungWire::Walker => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EstimateProvenance {
Measured,
Sampled,
Statistic,
Defaulted,
}
impl EstimateProvenance {
const VARIANTS: [Self; 4] = [
Self::Measured,
Self::Sampled,
Self::Statistic,
Self::Defaulted,
];
pub const NAMES: [&'static str; 4] = [
Self::VARIANTS[0].as_str(),
Self::VARIANTS[1].as_str(),
Self::VARIANTS[2].as_str(),
Self::VARIANTS[3].as_str(),
];
pub const fn as_str(self) -> &'static str {
match self {
EstimateProvenance::Measured => "measured",
EstimateProvenance::Sampled => "sampled",
EstimateProvenance::Statistic => "statistic",
EstimateProvenance::Defaulted => "defaulted",
}
}
pub fn from_name(name: &str) -> Option<Self> {
Self::VARIANTS
.into_iter()
.find(|provenance| provenance.as_str() == name)
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct PlanMetricsWire {
pub rows: i64,
pub time_ns: i64,
pub db_hits: i64,
pub memory_bytes: i64,
pub expression_built_bytes: i64,
pub reads: PlanReadsWire,
pub phases: PlanPhasesWire,
pub start: Option<PlanStartWire>,
pub kernel: Option<KernelRungWire>,
pub batched: bool,
pub zone_skips: i64,
pub frontier: PlanFrontierWire,
pub frontier_decline: Option<&'static str>,
pub memo: Option<super::plan_memo::PlanMemoWire>,
pub intx: PlanInTxWire,
pub expand_into: PlanExpandIntoWire,
pub hash_join: PlanHashJoinWire,
pub vector_scan: PlanVectorScanWire,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct PlanHashJoinWire {
pub build_rows: u64,
pub probe_rows: u64,
pub semi_mask_rejected: u64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct PlanVectorScanWire {
pub matrix: u64,
pub value_scan: u64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct PlanExpandIntoWire {
pub probes: u64,
pub reversed: u64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct PlanFrontierWire {
pub edge_visits: i64,
pub levels: i64,
pub endpoints: i64,
pub cells: i64,
pub memo_hits: i64,
pub memo_misses: i64,
pub representative_proofs: i64,
pub search_proven: i64,
pub search_disproven: i64,
pub declined_exhausted: i64,
pub budget_fraction: f64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct PlanInTxWire {
pub batches: i64,
pub committed: i64,
pub rolled_back: i64,
pub peak_input_rows_bytes: i64,
pub peak_output_rows_bytes: i64,
pub peak_scratch_bytes: i64,
pub peak_wal_bytes: i64,
}
impl PlanInTxWire {
pub fn ran(&self) -> bool {
self.batches > 0
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct PlanProfiledFacts {
pub metrics: PlanMetricsWire,
pub total_time_ns: i64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct PlanReadsWire {
pub hops: i64,
pub neighbor_walks: i64,
pub node_reads: i64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct PlanPhasesWire {
pub seek_ns: i64,
pub walk_ns: i64,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct PlanStartWire {
pub element: i64,
pub backward: bool,
pub reason: &'static str,
}