Fixing slow queries
Quick answer
Slowness usually traces back to the query. Check these.
Slowness usually traces back to the query. Check these.
- Review the Slow Query log for the offending statement.
- Ensure filtered fields are indexed.
- Avoid expensive dot-walking and calculated fields in list views.
- Replace record loops that count with GlideAggregate.
- Add
setLimit()and paginate large operations.
Want to learn this properly?
Our live, instructor-led ServiceNow Training covers this hands-on, with real projects and a certification path.
Check your understanding
What speeds up filtering on a field?
- A. An index
- B. A client script
- C. A UI policy
Show answer
A. An index
Indexed fields query faster.
Best way to count large sets?
- A. GlideAggregate
- B. A while loop
- C. A report gauge
Show answer
A. GlideAggregate
GlideAggregate counts in the database.
Frequently asked questions
What does the term Fixing slow queries refer to in ServiceNow?
Slowness usually traces back to the query. Check these.
What is another point to note about Fixing slow queries?
Review the Slow Query log for the offending statement. Ensure filtered fields are indexed. Avoid expensive dot-walking and calculated fields in list views.