ExecutionPlan

public struct ExecutionPlan : CustomStringConvertible

A structure representing the execution plan for a query in the database.

The ExecutionPlan provides details about how a query will be executed, including the collection being queried, the predicates applied, the estimated number of documents to scan, and the index strategy used.

  • Properties:

    • collection: The name of the collection being queried.
    • predicates: An array of tuples representing the query predicates, where each tuple contains a field name and a query operator.
    • estimatedDocsToScan: The estimated number of documents that will be scanned during the query execution.
    • shardsToSkip: The number of shards that can be skipped during query execution.
    • usedIndex: The name of the index used for the query, if any. If no index is used, this will be nil.
    • indexStrategy: The strategy used for indexing during query execution.
  • Conforms to:

    • CustomStringConvertible: Provides a human-readable description of the execution plan.
  • Undocumented

    Declaration

    Swift

    public let collection: String
  • Undocumented

    Declaration

    Swift

    public let predicates: [(field: String, op: QueryOperator)]
  • Undocumented

    Declaration

    Swift

    public let estimatedDocsToScan: Int
  • Undocumented

    Declaration

    Swift

    public let shardsToSkip: Int
  • Undocumented

    Declaration

    Swift

    public let usedIndex: String?
  • Undocumented

    Declaration

    Swift

    public let indexStrategy: IndexStrategy
  • Declaration

    Swift

    public var description: String { get }
  • An enumeration that defines the strategies for querying data in the database.

    • fullScan: Represents a strategy where the entire dataset is scanned to find matching results.
    • indexOnly: Represents a strategy where only the index is used to retrieve results, without scanning the full dataset.
    • hybrid: Represents a strategy that combines both index usage and partial dataset scanning to optimize query performance.
    See more

    Declaration

    Swift

    public enum IndexStrategy : CustomStringConvertible