Query run time
The total run time for a query encompasses several activities
other than just SQL execution.
For a continuable query, all query activities are repeated for each page that the client requests. The total search time is the sum of the search time for each page.
| Step | Activity | Applicable time limit |
|---|---|---|
| 1 | Executing the SQL query | RPC, Database |
| 2 | Fetching rows from the database | RPC |
| 3 | Checking security permissions to verify that the user has access to the fetched rows | RPC |
| 4 | Returning rows to the client |
As indicated, you can optionally apply time limits to a query. For the first query activity, the query database timeout setting applies. For the first three query activities as a combined group, the RPC time limit applies. For more information about these time limits, see the section "Query Options" in Relational Queries.
The following table shows some of the reasons why a query might
time out as a result of these limits.
| Reason | Relevant time limit |
|---|---|
| No database indexes exist to support the query | RPC, Database |
| Insufficient security permissions that cause the query to discard many results | RPC |
A LIKE condition in the query
that begins with a wildcard |
RPC, Database |
Unnecessary ORDER BY properties
for a query that returns many rows |
RPC, Database |
| A query with multiple joins, OR conditions or other complexity | RPC, Database |
| Property skew. For more information, see Property skew resolution. | RPC, Database |
| A large page size or non-paged query fetches a large number of rows | RPC |