QueryPlanner
public struct QueryPlanner
A structure responsible for planning and optimizing database queries.
QueryPlanner
provides statistical information about indexes and shards
to assist in query execution planning.
-
Undocumented
Declaration
Swift
public let indexStats: [String : IndexStat]
-
Undocumented
Declaration
Swift
public let shardStats: [ShardStat]
-
Initializes a new instance of the
QueryPlanner
class. -
Optimizes the execution plan for a query based on the provided collection, predicates, and available indexes.
Declaration
Swift
public func optimize( collection: String, predicates: [(field: String, op: QueryOperator)], availableIndexes: [String] ) -> ExecutionPlan
Parameters
collection
The name of the collection to query.
predicates
An array of tuples representing the query predicates, where each tuple contains:
availableIndexes
A list of available indexes for the collection.
Return Value
An
ExecutionPlan
object representing the optimized query execution plan.