pub struct SelectExecutor { /* private fields */ }Expand description
SELECT query executor for SSTable-based storage
Implementations§
Source§impl SelectExecutor
impl SelectExecutor
Sourcepub fn new(schema: Arc<SchemaManager>, storage: Arc<StorageEngine>) -> Self
pub fn new(schema: Arc<SchemaManager>, storage: Arc<StorageEngine>) -> Self
Create a new SELECT executor
Sourcepub async fn execute(&self, plan: OptimizedQueryPlan) -> Result<QueryResult>
pub async fn execute(&self, plan: OptimizedQueryPlan) -> Result<QueryResult>
Execute an optimized query plan
Sourcepub async fn execute_streaming(
&self,
plan: OptimizedQueryPlan,
config: StreamingConfig,
) -> Result<QueryResultIterator>
pub async fn execute_streaming( &self, plan: OptimizedQueryPlan, config: StreamingConfig, ) -> Result<QueryResultIterator>
Execute an optimized query plan with streaming results (Issue #280)
Instead of materializing all rows in memory, this method returns a
QueryResultIterator that yields rows incrementally via a bounded channel.
This enables memory-efficient processing of large result sets.
§Memory Budget
With default StreamingConfig::buffer_size of 1024 rows and ~1KB avg row size:
- Channel buffer: ~1MB in flight
- Background task: minimal overhead
- Total streaming overhead: ~1-2MB (well within 128MB target)
§Limitations
Currently supports:
- SSTableScan with predicates (streaming)
- Filter/Limit/Project (applied during scan)
LIMIT (and OFFSET, when present in the plan) is enforced by the
streaming producer (execute_streaming_background): it skips OFFSET
matches and stops scanning once count rows have been sent, so a
LIMIT N query yields exactly N rows without materializing the rest
(Issue #581).
For ORDER BY/GROUP BY/DISTINCT, falls back to full execution then streams results.