QUERY_TIMEOUT: meaning and how to fix it

SOQL and queries Checked against the official docs on Source: SOAP API Developer Guide: Core Data Types, StatusCode

Quick answer

QUERY_TIMEOUT: The query took too long, usually because it filters on non-indexed fields over a large object or returns too much data. Start with: Filter on indexed fields (such as Id, Name, lookups, external IDs) and use a narrower date range.

Typical message: QUERY_TIMEOUT: Your query request was running for too long.

Cause

The query took too long, usually because it filters on non-indexed fields over a large object or returns too much data.

How to fix QUERY_TIMEOUT

  1. Filter on indexed fields (such as Id, Name, lookups, external IDs) and use a narrower date range.
  2. Remove leading wildcards and negative filters like != where you can.
  3. For large exports, use Bulk API or query in smaller slices.

Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.

Frequently asked questions

What does QUERY_TIMEOUT mean in Salesforce?

The query took too long, usually because it filters on non-indexed fields over a large object or returns too much data.

How do I fix QUERY_TIMEOUT?

1. Filter on indexed fields (such as Id, Name, lookups, external IDs) and use a narrower date range. 2. Remove leading wildcards and negative filters like != where you can. 3. For large exports, use Bulk API or query in smaller slices.

More SOQL and queries errors

SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.