pub enum PhysicalPlan {
Show 19 variants
TableScan {
table: String,
},
IndexScan {
table: String,
index: String,
range_start: Option<Value>,
range_end: Option<Value>,
include_start: bool,
include_end: bool,
limit: Option<usize>,
offset: Option<usize>,
reverse: bool,
},
IndexGet {
table: String,
index: String,
key: Value,
limit: Option<usize>,
},
IndexInGet {
table: String,
index: String,
keys: Vec<Value>,
},
GinIndexScan {
table: String,
index: String,
key: String,
value: Option<String>,
query_type: String,
},
GinIndexScanMulti {
table: String,
index: String,
pairs: Vec<(String, String)>,
},
Filter {
input: Box<PhysicalPlan>,
predicate: Expr,
},
Project {
input: Box<PhysicalPlan>,
columns: Vec<Expr>,
},
HashJoin {
left: Box<PhysicalPlan>,
right: Box<PhysicalPlan>,
condition: Expr,
join_type: JoinType,
},
SortMergeJoin {
left: Box<PhysicalPlan>,
right: Box<PhysicalPlan>,
condition: Expr,
join_type: JoinType,
},
NestedLoopJoin {
left: Box<PhysicalPlan>,
right: Box<PhysicalPlan>,
condition: Expr,
join_type: JoinType,
},
IndexNestedLoopJoin {
outer: Box<PhysicalPlan>,
inner_table: String,
inner_index: String,
condition: Expr,
join_type: JoinType,
},
HashAggregate {
input: Box<PhysicalPlan>,
group_by: Vec<Expr>,
aggregates: Vec<(AggregateFunc, Expr)>,
},
Sort {
input: Box<PhysicalPlan>,
order_by: Vec<(Expr, SortOrder)>,
},
TopN {
input: Box<PhysicalPlan>,
order_by: Vec<(Expr, SortOrder)>,
limit: usize,
offset: usize,
},
Limit {
input: Box<PhysicalPlan>,
limit: usize,
offset: usize,
},
CrossProduct {
left: Box<PhysicalPlan>,
right: Box<PhysicalPlan>,
},
NoOp {
input: Box<PhysicalPlan>,
},
Empty,
}Expand description
Physical query plan node.
Variants§
TableScan
Full table scan.
IndexScan
Index scan with a key range.
Fields
IndexGet
Index point lookup.
Fields
IndexInGet
Index multi-point lookup (for IN queries). Performs multiple index lookups and unions the results.
GinIndexScan
GIN index scan for JSONB queries.
Fields
GinIndexScanMulti
GIN index scan for multiple JSONB predicates (AND combination). More efficient than multiple single GIN scans followed by intersection.
Fields
Filter
Filter operator.
Project
Projection operator.
HashJoin
Hash join.
SortMergeJoin
Sort-merge join.
NestedLoopJoin
Nested loop join.
IndexNestedLoopJoin
Index nested loop join.
Fields
outer: Box<PhysicalPlan>HashAggregate
Hash aggregate.
Sort
Sort operator.
TopN
TopN operator - combines Sort and Limit for efficient top-k selection. Uses a heap to maintain only the top N elements, avoiding full sort.
Limit
Limit and offset.
CrossProduct
Cross product.
NoOp
No-op step (passes through input).
Fields
input: Box<PhysicalPlan>Empty
Empty result.
Implementations§
Source§impl PhysicalPlan
impl PhysicalPlan
Sourcepub fn table_scan(table: impl Into<String>) -> Self
pub fn table_scan(table: impl Into<String>) -> Self
Creates a table scan plan.
Sourcepub fn index_scan(
table: impl Into<String>,
index: impl Into<String>,
range_start: Option<Value>,
range_end: Option<Value>,
) -> Self
pub fn index_scan( table: impl Into<String>, index: impl Into<String>, range_start: Option<Value>, range_end: Option<Value>, ) -> Self
Creates an index scan plan.
Sourcepub fn index_scan_with_limit(
table: impl Into<String>,
index: impl Into<String>,
range_start: Option<Value>,
range_end: Option<Value>,
limit: Option<usize>,
offset: Option<usize>,
) -> Self
pub fn index_scan_with_limit( table: impl Into<String>, index: impl Into<String>, range_start: Option<Value>, range_end: Option<Value>, limit: Option<usize>, offset: Option<usize>, ) -> Self
Creates an index scan plan with limit and offset.
Sourcepub fn index_scan_with_options(
table: impl Into<String>,
index: impl Into<String>,
range_start: Option<Value>,
range_end: Option<Value>,
limit: Option<usize>,
offset: Option<usize>,
reverse: bool,
) -> Self
pub fn index_scan_with_options( table: impl Into<String>, index: impl Into<String>, range_start: Option<Value>, range_end: Option<Value>, limit: Option<usize>, offset: Option<usize>, reverse: bool, ) -> Self
Creates an index scan plan with limit, offset, and reverse option.
Sourcepub fn index_get(
table: impl Into<String>,
index: impl Into<String>,
key: Value,
) -> Self
pub fn index_get( table: impl Into<String>, index: impl Into<String>, key: Value, ) -> Self
Creates an index point lookup plan.
Sourcepub fn index_get_with_limit(
table: impl Into<String>,
index: impl Into<String>,
key: Value,
limit: Option<usize>,
) -> Self
pub fn index_get_with_limit( table: impl Into<String>, index: impl Into<String>, key: Value, limit: Option<usize>, ) -> Self
Creates an index point lookup plan with limit.
Sourcepub fn index_in_get(
table: impl Into<String>,
index: impl Into<String>,
keys: Vec<Value>,
) -> Self
pub fn index_in_get( table: impl Into<String>, index: impl Into<String>, keys: Vec<Value>, ) -> Self
Creates an index multi-point lookup plan (for IN queries).
Sourcepub fn gin_index_scan(
table: impl Into<String>,
index: impl Into<String>,
key: impl Into<String>,
value: Option<String>,
query_type: impl Into<String>,
) -> Self
pub fn gin_index_scan( table: impl Into<String>, index: impl Into<String>, key: impl Into<String>, value: Option<String>, query_type: impl Into<String>, ) -> Self
Creates a GIN index scan plan.
Sourcepub fn gin_index_scan_multi(
table: impl Into<String>,
index: impl Into<String>,
pairs: Vec<(String, String)>,
) -> Self
pub fn gin_index_scan_multi( table: impl Into<String>, index: impl Into<String>, pairs: Vec<(String, String)>, ) -> Self
Creates a GIN index scan plan for multiple key-value pairs (AND combination).
Sourcepub fn filter(input: PhysicalPlan, predicate: Expr) -> Self
pub fn filter(input: PhysicalPlan, predicate: Expr) -> Self
Creates a filter plan.
Sourcepub fn project(input: PhysicalPlan, columns: Vec<Expr>) -> Self
pub fn project(input: PhysicalPlan, columns: Vec<Expr>) -> Self
Creates a projection plan.
Sourcepub fn hash_join(
left: PhysicalPlan,
right: PhysicalPlan,
condition: Expr,
join_type: JoinType,
) -> Self
pub fn hash_join( left: PhysicalPlan, right: PhysicalPlan, condition: Expr, join_type: JoinType, ) -> Self
Creates a hash join plan.
Sourcepub fn sort_merge_join(
left: PhysicalPlan,
right: PhysicalPlan,
condition: Expr,
join_type: JoinType,
) -> Self
pub fn sort_merge_join( left: PhysicalPlan, right: PhysicalPlan, condition: Expr, join_type: JoinType, ) -> Self
Creates a sort-merge join plan.
Sourcepub fn nested_loop_join(
left: PhysicalPlan,
right: PhysicalPlan,
condition: Expr,
join_type: JoinType,
) -> Self
pub fn nested_loop_join( left: PhysicalPlan, right: PhysicalPlan, condition: Expr, join_type: JoinType, ) -> Self
Creates a nested loop join plan.
Sourcepub fn hash_aggregate(
input: PhysicalPlan,
group_by: Vec<Expr>,
aggregates: Vec<(AggregateFunc, Expr)>,
) -> Self
pub fn hash_aggregate( input: PhysicalPlan, group_by: Vec<Expr>, aggregates: Vec<(AggregateFunc, Expr)>, ) -> Self
Creates a hash aggregate plan.
Sourcepub fn sort(input: PhysicalPlan, order_by: Vec<(Expr, SortOrder)>) -> Self
pub fn sort(input: PhysicalPlan, order_by: Vec<(Expr, SortOrder)>) -> Self
Creates a sort plan.
Sourcepub fn top_n(
input: PhysicalPlan,
order_by: Vec<(Expr, SortOrder)>,
limit: usize,
offset: usize,
) -> Self
pub fn top_n( input: PhysicalPlan, order_by: Vec<(Expr, SortOrder)>, limit: usize, offset: usize, ) -> Self
Creates a TopN plan for efficient top-k selection.
Sourcepub fn limit(input: PhysicalPlan, limit: usize, offset: usize) -> Self
pub fn limit(input: PhysicalPlan, limit: usize, offset: usize) -> Self
Creates a limit plan.
Sourcepub fn is_incrementalizable(&self) -> bool
pub fn is_incrementalizable(&self) -> bool
Checks if this plan can be incrementalized.
Sourcepub fn inputs(&self) -> Vec<&PhysicalPlan>
pub fn inputs(&self) -> Vec<&PhysicalPlan>
Returns the input plan(s) of this node.
Trait Implementations§
Source§impl Clone for PhysicalPlan
impl Clone for PhysicalPlan
Source§fn clone(&self) -> PhysicalPlan
fn clone(&self) -> PhysicalPlan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more