Type alias ExplainOptions

ExplainOptions: {
    allPlans?: boolean;
    failOnWarning?: boolean;
    fullCount?: boolean;
    maxNodesPerCallstack?: number;
    maxNumberOfPlans?: number;
    maxWarningCount?: number;
    optimizer?: {
        rules: string[];
    };
    profile?: number;
}

Options for explaining a query.

See databases.Database#explain.

Type declaration

  • Optional allPlans?: boolean

    If set to true, all possible execution plans will be returned as the plans property. Otherwise only the optimal execution plan will be returned as the plan property.

    Default: false

  • Optional failOnWarning?: boolean

    If set to true, the query throws an exception and aborts instead of producing a warning. You should use this option during development to catch potential issues early. When the attribute is set to false, warnings are not propagated to exceptions and are returned with the query result.

    Default: Controlled by the --query.fail-on-warning startup option.

  • Optional fullCount?: boolean

    Whether to calculate the total number of documents matching the filter conditions as if the query's final top-level LIMIT operation were not applied. This option generally leads to different execution plans.

    Default: false

  • Optional maxNodesPerCallstack?: number

    The number of execution nodes in the query plan after that stack splitting is performed to avoid a potential stack overflow.

    This option is only useful for testing and debugging and normally does not need any adjustment.

    Default: Controlled by the --query.max-nodes-per-callstack startup option.

  • Optional maxNumberOfPlans?: number

    Maximum number of plans that the optimizer is allowed to generate. Setting this to a low value limits the amount of work the optimizer does.

  • Optional maxWarningCount?: number

    Limits the number of warnings a query can return. You can increase or decrease the number with this option.

    Default: 10

  • Optional optimizer?: {
        rules: string[];
    }

    An object with a rules property specifying a list of optimizer rules to be included or excluded by the optimizer for this query. Prefix a rule name with + to include it, or - to exclude it. The name all acts as an alias matching all optimizer rules.

    • rules: string[]
  • Optional profile?: number

    Whether to include additional query profiling information. If set to 2, the response includes the time it took to process each optimizer rule under stats.rules.

    Default: 0