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
QueryPlannerclass. -
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] ) -> ExecutionPlanParameters
collectionThe name of the collection to query.
predicatesAn array of tuples representing the query predicates, where each tuple contains:
availableIndexesA list of available indexes for the collection.
Return Value
An
ExecutionPlanobject representing the optimized query execution plan.
View on GitHub