QueryStrategy

public enum QueryStrategy : Sendable, Equatable, CustomStringConvertible

Describes the strategy that QueryBuilder will use to execute a query.

The strategy is determined by explain() based on the availability of indexes and partition key predicates. The query planner selects the most efficient access path automatically.

  • Use a sorted index on the given field for point or range lookups. This is the most efficient strategy when a matching index exists.

    Declaration

    Swift

    case indexLookup(field: String)
  • Restrict the scan to a single partition shard based on the partition key value. Avoids scanning other shards entirely.

    Declaration

    Swift

    case partitionScan(value: String)
  • Scan every shard in the collection. Used when no index or partition pruning is applicable. All predicates are evaluated in memory.

    Declaration

    Swift

    case fullScan
  • A human-readable description of the strategy.

    Declaration

    Swift

    public var description: String { get }