pub struct Relation {
pub name: String,
pub arity: usize,
pub estimated_rows: u64,
pub bound_columns: BTreeSet<usize>,
}Expand description
A relation (predicate) with arity and estimated cardinality.
Fields§
§name: StringName of the relation / predicate.
arity: usizeNumber of columns (arity).
estimated_rows: u64Estimated number of rows (tuples).
bound_columns: BTreeSet<usize>Which columns have known bindings (constants / previously bound variables).
Implementations§
Source§impl Relation
impl Relation
Sourcepub fn new(name: impl Into<String>, arity: usize, estimated_rows: u64) -> Self
pub fn new(name: impl Into<String>, arity: usize, estimated_rows: u64) -> Self
Create a new relation with no bound columns.
Sourcepub fn with_binding(self, col: usize) -> Self
pub fn with_binding(self, col: usize) -> Self
Mark a column as bound and return self (builder pattern).
Sourcepub fn selectivity(&self) -> f64
pub fn selectivity(&self) -> f64
Fraction of columns that are bound. Returns 0.0 when arity is 0.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Relation
impl RefUnwindSafe for Relation
impl Send for Relation
impl Sync for Relation
impl Unpin for Relation
impl UnsafeUnpin for Relation
impl UnwindSafe for Relation
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more