Error Reference

Database index not used: query performing full table scan

Database index not used: query performing full table scan

Where this appears

This error appears in the System Log under System Diagnostics > Log > Application Log when queries execute against large tables without utilizing available indexes. It commonly occurs during list view loading, reporting operations, or scheduled jobs that query tables with millions of records.

Sourdough
Chrome Extension

Debugging this in a real instance?

Sourdough lets you trace "Database index not used: query performing full table scan" through system logs, script errors, and API health in the ServiceNow tab you are already using.

Add to Chrome

Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.

Overview
Tasks
CMDB
API
Metrics
Monitor
Internals
Instance:sourdoughdev·Version:Yokohama
Instance StateONLINE
System StatusFully Operational
Session Timeout90 minutes
Logged-In Sessions2 (20 active)
Build Nameyokohama-12-18-2024_p1
IP Address10.159.128.43
Instance HealthHealth Score: 90%
🔥 5dSourdough (Chrome Plugin)Dark Mode

Cause

Query uses OR conditions at the beginning of the filter, preventing index optimization from selecting the most efficient index path. (high likelihood)

Query contains CONTAINS, DOES NOT CONTAIN, or LIKE operators with wildcards, which cannot leverage standard B-tree indexes effectively. (high likelihood)

Table statistics are outdated, causing the query optimizer to make poor decisions about index usage and execution plans. (medium likelihood)

No appropriate index exists for the specific combination of fields being queried in the WHERE clause. (medium likelihood)

Query involves joins across multiple tables where foreign key indexes are missing or the join conditions are not optimized. (low likelihood)

Fix

Step 1: Navigate to System Diagnostics > Stats and run 'stats.do' to identify the specific table and query causing the full table scan.

Step 2: Review the query structure in the System Log to identify OR conditions at the beginning of filters and rewrite them using AND conditions or separate queries where possible.

Step 3: Check for CONTAINS or LIKE operators in the problematic query and consider replacing them with STARTSWITH or exact match conditions, or implement Text Search indexes if full-text search is required.

Step 4: Navigate to System Definition > Tables and verify that appropriate indexes exist for the queried fields by checking the table's Index tab.

Step 5: Update table statistics by navigating to System Diagnostics > Stats > Table Stats and running statistics collection for the affected table.

Step 6: If no suitable index exists, create a composite index on the frequently queried field combinations through System Definition > Indexes.

Step 7: Test the query performance after changes using the Query Performance module under System Diagnostics to verify the index is now being used.

Step 8: Monitor the System Log for 24-48 hours to confirm the full table scan warnings no longer appear for the optimized queries.

Test Your Knowledge

Quick 3-question quiz. See how your ServiceNow skills stack up.

Question 1 of 3Performance

A list view on a table with millions of records is slow. Best fix?

Select an answer to continue