CMDB Query Builder engine execution modes

  • Release version: Australia
  • Updated March 12, 2026
  • 4 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of CMDB Query Builder engine execution modes

    The CMDB Query Builder engine in ServiceNow Australia release uses two execution modes—V2 (enhanced) and V1 (legacy)—to run configuration management database queries. The default mode is V2, optimized for faster execution and handling larger result sets while maintaining performance. However, not all query structures are supported in V2, causing some queries to automatically revert to V1 for successful execution.

    Show full answer Show less

    Execution Modes Details

    • V2 Mode: Default, improved performance and scalability, processes complex queries quickly and efficiently. Not all query structures are supported.
    • V1 Mode: Legacy engine used explicitly or as fallback for unsupported query structures in V2.

    Special Considerations for Queries with 'OR' Operators

    Queries containing logical 'OR' operators run faster in V2 but produce results formatted differently compared to V1. In V2 mode, related results are merged into single items, whereas V1 shows them as separate entries. For legacy reporting compatibility, V1 mode can be enforced for such queries using the glide.cmdb.query.orexecutionmode system property.

    Configuration and Settings Hierarchy

    • Query-Level Setting: The Query Execution Mode attribute on individual saved queries has the highest precedence and controls execution mode per query.
    • Global System Properties:
      • glide.cmdb.query.executionmode: Sets default engine mode when query-level mode is unspecified.
      • glide.cmdb.query.orexecutionmode: Controls execution mode for queries with 'OR' conditions and affects result format. This overrides glide.cmdb.query.executionmode.

    Unsupported Query Structures in V2 Mode

    V2 mode does not support certain complex query types, including:

    • Filters with related list conditions.
    • Nodes without relationships but with configuration item conditions (e.g., "Server NOT connected to Router WHERE Router.status = Active").
    • Service Mapping queries involving related edges or specific service query properties (e.g., Find Related/Unrelated CIs, Does Not Belong to Service).

    Such queries automatically run in V1 mode, ensuring compatibility and successful execution.

    Decision Flow for Execution Mode Selection

    The system determines which engine to use by:

    1. Checking the query-level Query Execution Mode attribute: if set to V1 or V2, that mode is used or further evaluated accordingly.
    2. If unset, checking global system properties for default mode and special handling of 'OR' conditions.
    3. Performing a structure compatibility check to confirm if the query is supported in V2.
    4. Automatically falling back to V1 if the query structure is unsupported in V2.

    The execution mode assigned to each query is visible in the Query Execution Mode attribute within the Query Status table.

    Practical Impact for ServiceNow Customers

    By understanding and configuring these modes and system properties, customers can:

    • Optimize query performance using the enhanced V2 engine when possible.
    • Maintain compatibility with existing reports that depend on legacy result formats by controlling execution mode for 'OR' queries.
    • Ensure all queries execute successfully by leveraging automatic fallback mechanisms.
    • Customize execution mode per query or globally to meet organizational requirements.

    The CMDB Query Builder engine uses two execution modes to run queries. By default, the system is configured to use the enhanced mode V2 which is designed for performance optimization. V2 is supported for most queries and enables running complex queries significantly quicker and process larger result sets without performance degradation.

    The CMDB Query Builder can be set with the following engine execution modes for running queries:
    V2

    An enhanced query execution engine designed for improved performance and scalability. This is the default execution engine. In V2 mode, compared to V1 mode, the CMDB Query Builder engine is capable of running complex queries significantly quicker and process larger result sets without performance degradation.

    However, some query structures aren't supported for the V2 mode, in which case such queries will automatically run using the legacy mode (V1).

    V1
    Legacy execution engine which is used when the system is explicitly configured to use V1. This mode is also used even if the system is configured to run in V2 mode, to run queries with a structure that isn't supported for the V2 mode.

    Considerations for the 'OR' operator

    Setting the execution mode for queries that contain 'OR' operators, such as the sample query below, require some special considerations:

    Query with 'OR' structure

    Running a query with 'OR' structures can be significantly faster in V2 mode than in V1, but the results are presented differently between V1 and V2 execution modes. The difference is because 'OR' operator nodes generate coalesced and cross-product result sets. In V2 mode, related results are merged into a single result item. In V1, the same results are represented by separate result items.

    Figure 1. Results for a query with an 'OR' structure, in V1 execution mode
    'OR' results in V1 execution mode
    Figure 2. Results for a query with an 'OR' structure, in V2 execution mode
    'OR' results in V2 execution mode

    In some situations, it might be important to run a query with an 'OR' structure, using the V1 engine mode to retain the legacy format of the results in support of existing organizational reports. You can use the glide.cmdb.query.or_execution_mode system property as described below to control execution mode for queries with 'OR' structures.

    Settings

    The system uses the following settings of execution mode to determine which execution mode to use to run a query:
    • Query-level setting:

      The Query Execution Mode attribute in the Saved Queries [qb_saved_query] table sets the engine mode for the respective query. For more information about this setting, see Set execution mode for running a query.

      The query-level setting has precedence over system property settings.

    • Global setting:

      System property glide.cmdb.query.execution_mode sets the system-wide default mode to use when a query's mode isn't set at the query level.

    • Global setting:

      System property glide.cmdb.query.or_execution_mode sets the system-wide default execution engine mode for queries that contain at least one logical OR condition. Because the results of a query with an 'OR' structure are formatted differently between V1 and V2 mode, this property setting also affects which format is used for the results.

      This property has precedence over the glide.cmdb.query.execution_mode system property.

    For more information about the engine mode system properties, see Property settings for CMDB Query Builder.

    Unsupported query structures for V2 mode

    The following query structures aren't supported in V2 and therefore are executed using V1 mode even if the system is configured to use V2 mode:
    • Queries with filters containing related list conditions.
    • No relationships combined with a filter containing configuration item conditions: Node that has no relationships configured and the target node's filter has configuration item conditions.

      For example: Server NOT connected to Router WHERE Router.status = Active.

    • Service Mapping query with related edges (Applicative flow, Not Applicative flow, Belongs To, Not belongs to). Service Mapping query with service query properties set to Find Related CIs or Find Unrelated CIs, or a combination query in which a service query connection property is set to Does Not Belong to Service.

    Decision flow

    The system uses a decision flow that checks all relevant settings and the query structure to determine which execution mode to use for running a query. First, the system checks the query-level and the system-level settings. Then, if the settings are configured for using V2 to run a query, the system checks the query structure to determine if the V2 execution mode supports the query's structure. If the query contains a structure that isn't supported in V2, execution automatically falls back to using V1 mode even though the settings are configured to using V2. This automatic fallback mechanism supports a successful execution of all queries while maximizing performance benefits where possible.

    Using default settings, if a query structure is supported by the V2 execution mode, the query executes using V2 mode.

    The following decision flow examines settings and query structures, to determine whether a query runs in V1 or V2 engine execution mode:
    1. Check the setting in the Query Execution Mode attribute in the query record in the Saved Queries [qb_saved_query] table:
      • If 'V1': Use V1
      • If 'V2': Skip to step #4 — Perform V2 support check
      • If 'None': Check system properties as described in the next step
    2. Check system property glide.cmdb.query.execution_mode:
      • If not set: Use V2 pending support check
      • If 'V1': Use V1
      • If 'V2':
        • If no logical OR conditions: Skip to step #4 — Perform V2 support check
        • If one or more logical OR conditions: Perform 'OR'-specific check as described in the next step
    3. Check the value of glide.cmdb.query.or_execution_mode:
      • If 'V1': Use V1
      • If 'V2': Skip to step #4 — Perform V2 support check
      • If empty: Use V2
    4. Perform V2 support check:
      • If the query contains a structure that isn't supported in V2: Use V1
      • If query structure is supported in V2: Use V2

    The Query Execution Mode attribute in table Query Status [qb_query_status] shows the execution mode assigned to each query.