OBLYTECH Logo
OBLYTECH Logo

Set the batch size for a CMDB Query Builder query

A slow or timing-out Query Builder query can be tuned on its own saved-query record. Edit Execution Batch Size there, and change the global property only when the change should apply to every query. A saved query value overrides the global glide.cmdb.query.batch_size property. Confirm the exact property name in System Properties on your instance before you add it, because two spellings of this name are in use. When neither override is configured, Query Builder uses 100. Choose the scope first, then compare query runs before and after changing it.

A query’s effective batch size comes from three settings in priority order

A slow query does not necessarily need an instance-wide setting change. Query Builder queries can span different classes and relationships, so a shared default can suit one workload and leave another taking much longer to complete. Batch size is one setting to examine when a query runs slowly or times out.

The effective value follows this order:

  1. A value in Execution Batch Size on the individual Saved Queries record takes priority.
  2. If that query has no configured override, glide.cmdb.query.batch_size supplies the global value when the property exists and is configured.
  3. If neither setting supplies an override, the base system value is 100.

For example, suppose an administrator configures a global value and later gives one saved query its own batch size. Changing the global property again does not replace that query-specific choice. Before investigating an apparently ignored property change, inspect the saved record for an existing override.

Keep a short record of both settings during troubleshooting. Writing down the property alone leaves out the highest-priority setting. Writing down the query field alone leaves out the fallback that matters when returning the query to shared configuration.

Changing the batch size for one saved query

For the saved-query change, Brazil and Australia require sn_cmdb_admin or admin. Zurich and Yokohama require admin. Check the role requirement against your instance and release before making the change; do not assume that access to run a query also grants permission to edit its execution configuration.

  1. Identify the saved query that is slow or timing out. Record its current execution behavior and whether the problem occurs consistently.
  2. Enter qb_saved_query.list in the Filter navigator and press Enter. This opens the Saved Queries table.
  3. Locate the record for the query you intend to tune. Check the query identity carefully if several records have similar names.
  4. Inspect Execution Batch Size and record any existing value before editing it.
  5. Set or modify Execution Batch Size. The tuning procedure calls for increasing an existing value, or choosing a value above the applicable global value.
  6. Run the same query again and compare the outcome with your baseline.

Use the saved record as the unit of change. If the reported problem concerns one named query, an override on that record makes the experiment easier to assess. It also avoids making a global adjustment simply to discover whether batch size affects that particular workload.

Do not choose a production value from an unrelated query’s result. The amount of data, relationship count, and system load influence the appropriate choice. A value that helped a narrow query is not evidence that a broader query needs the same setting.

Choose between the global property and a saved-query override

Use glide.cmdb.query.batch_size when the intended change is the shared batch size for query runs. Add the property if necessary and configure its value. Saved queries with Execution Batch Size already set retain their higher-priority overrides, so review those exceptions when assessing the reach of a global change.

Use the query field when one saved query needs separate treatment. This makes the tuning decision explicit on the record that needs it. It is also easier to explain in a change review: the shared configuration remains a fallback, while the selected query has a deliberate exception.

Before choosing a global change, list the queries you intend to affect and the saved overrides you expect to remain. Include the reason for changing the shared setting. A single timeout is a reason to investigate that query, but it does not establish a suitable global value for unrelated workloads.

If a query’s selection logic also needs review, examine its criteria separately. The guide to ServiceNow search operators covers a neighboring filtering topic. Keep criteria edits and batch-size edits in separate comparisons so their effects can be distinguished.

For help planning this work, see ServiceNow implementation.

Build a comparison that explains the result

Start with the same saved query, criteria, and initiation method. Record the current query override, any global property value, and whether the run completes. Note elapsed time if you are collecting it. These observations provide a baseline without assuming that a different number guarantees an improvement.

Next, make one batch-size change and repeat the run under comparable conditions. Record the new configuration alongside the result. If the query completes after previously timing out, preserve the conditions of that comparison rather than treating one successful run as proof of a permanent fix.

System load matters when interpreting the result. A run made during a quiet period and a run made during heavy activity are not clean equivalents. Note obvious workload differences and repeat the comparison when the operating conditions make the result hard to interpret.

Where scheduled activity is part of the investigation, the system events and scheduled jobs dashboard provides related operational context. Keep the query’s execution setting visible in your investigation notes instead of treating scheduling and batch size as interchangeable explanations.

Define the decision before expanding the change. For example, decide whether the selected query completes reliably enough for its intended use and whether the observations justify keeping its override. If the result is inconclusive, retain the measurements and configuration history for further investigation.

Check the same setting across run scenarios

Batch-size selection applies to Query Builder user interface runs, including ad hoc and saved queries, as well as the Query Builder Scriptable API, scheduled jobs, and CMDB groups. The initiation method does not create a separate priority order. Include the way a query is started in your test record so you reproduce the reported issue.

For a saved query used through several routes, check which saved record each route actually invokes. A tuning result is difficult to interpret if an interactive test uses one record while a scheduled run uses another. Confirm identity before concluding that a setting behaves differently between execution methods.

Separate batch-size diagnosis from the meaning of the queried data. If the relationships or classes in the query are under review, the guide to CSDM domains and CMDB classes addresses that modeling context. Changing execution configuration does not answer whether the query represents the intended model.

Record the tested initiation routes in the handover. This helps the next administrator distinguish a measured result from an assumption about another route. It also provides a clear starting point if the same saved query later shows a different completion pattern.

Before closing the investigation, document which observation would trigger another review. A later timeout, a changed query definition, or a different workload can make the earlier comparison less representative. Keeping that review condition with the saved-query decision gives the next administrator a concrete reason to revisit the configuration.

Questions to resolve before approving the change

What should a batch-size change request contain?

Include the query identity, the observed problem, the prior settings, the proposed scope, and the comparison plan. State whether the request affects one saved query or the shared fallback. This gives reviewers enough context to assess the intended reach without reconstructing the investigation.

How should a team organize tests for several slow queries?

Keep a separate observation record for each query. Grouping them under one performance issue can help coordination, but it should not erase their different classes, relationships, or existing overrides. Establish an individual baseline before deciding whether a shared configuration change is justified.

What should happen when a test produces mixed results?

Avoid choosing a value from the fastest isolated run. Compare the recorded conditions, identify differences, and plan another controlled observation. Mixed results are a reason to improve the comparison before turning an experimental value into an accepted configuration.

What information helps another administrator continue the investigation?

Provide the saved record identity, previous and current values, initiation route, completion observations, and relevant workload notes. Include the reason you kept or rejected the change. This preserves the evidence behind the decision and reduces the chance of repeating an inconclusive experiment.

How should the team document a temporary exception?

Name an owner and a review point in the change record. Describe the condition that would justify retaining the exception and preserve the earlier configuration for comparison. A recorded review plan helps distinguish a query that still needs separate treatment from one whose override has simply been forgotten.