KB-1681 Unable to retrieve data due to query timeout


A query rule fails to run and one of the following errors is seen in the application server log:

Expression evaluation error in rule '<rule name>' (called by rules '<rule name 1>' > '<rule name 2>') at function a!queryEntity: An error occurred while retrieving the data. (APNX-1-4198-000)
Expression evaluation error in rule '<rule name>' at function 'queryruleexec': Error evaluating function 'queryruleexec' : Unexpected error executing query (type: [<CDT name>], query: [<rule name>], order by: [[]], filters:[null])

with one of the following "caused by" clauses:

Caused by: java.sql.SQLTimeoutException: (conn=<connection id>) Query execution was interrupted (max_statement_time exceeded)
Caused by: com.mysql.jdbc.exceptions.MySQLTimeoutException: Statement cancelled due to timeout or client request
Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The query has timed out.


These errors indicate that the query reached the query timeout threshold, causing it to time out. This threshold is set to 10 seconds for Appian Cloud environments. For more information about this timeout threshold, see our documentation on Query Rule Limits


Review the 'Execute Time (ms)' column of the perf_monitor_rdbms_slow.csv log located in <APPIAN_HOME>/logs/perflogs to confirm if the failed query exceeded the configured timeout value. 

The query should be optimized so that it can be completed within the timeout. See: Database Performance Best Practices and An Introduction to Query Optimization.

Note: increasing the timeout threshold may impact system performance and stability, and is not configurable for Appian Cloud.

Affected Versions

This article applies to all versions of Appian.

Last Reviewed: May 2022