pub struct QueryEngine { /* private fields */ }Expand description
Query engine with caching and statistics
Implementations§
Source§impl QueryEngine
impl QueryEngine
Sourcepub fn new(
storage: Arc<StorageEngine>,
schema: Arc<SchemaManager>,
_memory: Arc<MemoryManager>,
config: &Config,
) -> Result<Self>
pub fn new( storage: Arc<StorageEngine>, schema: Arc<SchemaManager>, _memory: Arc<MemoryManager>, config: &Config, ) -> Result<Self>
Create a new query engine
Sourcepub async fn execute(&self, cql: &str) -> Result<QueryResult>
pub async fn execute(&self, cql: &str) -> Result<QueryResult>
Execute a CQL query
Sourcepub async fn execute_streaming(
&self,
cql: &str,
config: StreamingConfig,
) -> Result<QueryResultIterator>
pub async fn execute_streaming( &self, cql: &str, config: StreamingConfig, ) -> Result<QueryResultIterator>
Execute a CQL query with streaming results (Issue #280)
Returns a QueryResultIterator that yields rows incrementally via a bounded
channel, enabling memory-efficient processing of large result sets.
§Arguments
cql- The CQL query string to execute (must be a SELECT statement)config- Streaming configuration (buffer size, chunk hints)
§Errors
Returns an error if:
- Query is not a SELECT statement
- SQL syntax is invalid
- Query execution fails
§Memory Budget
The streaming approach stays within the 128MB target by using bounded channels and processing rows incrementally rather than materializing all results.
Sourcepub async fn execute_with_params(
&self,
cql: &str,
_params: &[Value],
) -> Result<QueryResult>
pub async fn execute_with_params( &self, cql: &str, _params: &[Value], ) -> Result<QueryResult>
Execute a query with parameters
Sourcepub async fn prepare(&self, cql: &str) -> Result<Arc<PreparedQuery>>
pub async fn prepare(&self, cql: &str) -> Result<Arc<PreparedQuery>>
Prepare a query for repeated execution
Sourcepub async fn execute_prepared(
&self,
prepared: &PreparedQuery,
params: &[Value],
) -> Result<QueryResult>
pub async fn execute_prepared( &self, prepared: &PreparedQuery, params: &[Value], ) -> Result<QueryResult>
Execute a prepared query
Sourcepub fn stats(&self) -> QueryStats
pub fn stats(&self) -> QueryStats
Get query statistics
Sourcepub fn clear_caches(&self)
pub fn clear_caches(&self)
Clear all caches
Sourcepub fn clear_prepared_cache(&self)
pub fn clear_prepared_cache(&self)
Clear prepared statement cache
Sourcepub fn clear_plan_cache(&self)
pub fn clear_plan_cache(&self)
Clear query plan cache
Sourcepub fn cache_stats(&self) -> CacheStats
pub fn cache_stats(&self) -> CacheStats
Get cache statistics
Sourcepub async fn explain(&self, cql: &str) -> Result<ExplainResult>
pub async fn explain(&self, cql: &str) -> Result<ExplainResult>
Optimize a query (return execution plan without executing)
Sourcepub async fn analyze(&self, cql: &str) -> Result<AnalyzeResult>
pub async fn analyze(&self, cql: &str) -> Result<AnalyzeResult>
Analyze query performance
Sourcepub async fn has_schema_for_table(&self, table: &str) -> bool
pub async fn has_schema_for_table(&self, table: &str) -> bool
Check if schema is available for a table
Sourcepub async fn schema_status(&self, table: &str) -> SchemaStatus
pub async fn schema_status(&self, table: &str) -> SchemaStatus
Get detailed schema status for debugging