Skip to main content

QueryEngine

Struct QueryEngine 

Source
pub struct QueryEngine { /* private fields */ }
Expand description

Query engine with caching and statistics

Implementations§

Source§

impl QueryEngine

Source

pub fn new( storage: Arc<StorageEngine>, schema: Arc<SchemaManager>, _memory: Arc<MemoryManager>, config: &Config, ) -> Result<Self>

Create a new query engine

Source

pub async fn execute(&self, cql: &str) -> Result<QueryResult>

Execute a CQL query

Source

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.

Source

pub async fn execute_with_params( &self, cql: &str, _params: &[Value], ) -> Result<QueryResult>

Execute a query with parameters

Source

pub async fn prepare(&self, cql: &str) -> Result<Arc<PreparedQuery>>

Prepare a query for repeated execution

Source

pub async fn execute_prepared( &self, prepared: &PreparedQuery, params: &[Value], ) -> Result<QueryResult>

Execute a prepared query

Source

pub fn stats(&self) -> QueryStats

Get query statistics

Source

pub fn clear_caches(&self)

Clear all caches

Source

pub fn clear_prepared_cache(&self)

Clear prepared statement cache

Source

pub fn clear_plan_cache(&self)

Clear query plan cache

Source

pub fn cache_stats(&self) -> CacheStats

Get cache statistics

Source

pub async fn explain(&self, cql: &str) -> Result<ExplainResult>

Optimize a query (return execution plan without executing)

Source

pub async fn analyze(&self, cql: &str) -> Result<AnalyzeResult>

Analyze query performance

Source

pub async fn has_schema_for_table(&self, table: &str) -> bool

Check if schema is available for a table

Source

pub async fn schema_status(&self, table: &str) -> SchemaStatus

Get detailed schema status for debugging

Trait Implementations§

Source§

impl Debug for QueryEngine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.