Resolving Service Portal Slowness Due to Unoptimized sysapproval_approver Queries
Issue
Service Portal pages may become unresponsive or load slowly due to inefficient database queries. In this case, slowness is linked to complex queries against the sysapproval_approver table, particularly in environments with high record volumes or insufficient indexing.
Release
All releases
Resolution
1) Profile slow queries
- Use the DB Query Profiler or Slow Transaction Logs to identify queries with execution times exceeding 5+ seconds.
- Look for queries hitting the
sysapproval_approvertable with high row scan counts.
2) Apply query rewrites (UNION replacement)
- Rewrite complex
OR-based queries usingUNIONclauses to split conditions. - This can improve index utilization and allow more efficient query execution.
3) Create composite indexes
- Based on slow query analysis, create targeted indexes on the
sysapproval_approvertable (for example, combining frequently filtered columns likeapprover,state, orapproval). - Use Index Advisor to validate performance gains.
The world works with ServiceNow.