SQL Execution Fails With the Error Message "canceling statement due to statement timeout" Reported
Symptom
When an SQL statement is executed for more than 2 hours, the following error information is displayed:
1
|
ERROR: canceling statement due to statement timeoutTime. |
Possible Causes
If the execution time of a statement exceeds the time specified by statement_timeout, an error is reported and the statement execution exits.
Handling Procedure
Method 1: Modify the statement_timeout parameter on the console.
- Log in to the GaussDB(DWS) management console.
- In the navigation pane on the left, choose Clusters.
- In the cluster list, find the target cluster and click its name. The cluster information page is displayed.
- Click the Parameter Modifications tab and modify the value of parameter session_timeout. Click Save.
By default, GaussDB(DWS) does not trigger SQL timeout. The default value of statement_timeout is 0. If you have manually modified this parameter, you are advised to change it back to the default value 0 or set it to a proper value to prevent SQL timeout affecting other tasks.
- In the Modification Preview dialog box, confirm the modification and click Save.
- If No is displayed in the Restart Cluster column of the statement_timeout parameter, the parameter modification takes effect immediately without restart.
Figure 1 Modifying the statement_timeout parameter
- Use the SET statement to change the value (session level):
1
SET statement_timeout TO 0;
- Run the ALTER ROLE statement to change the value (user level):
1
ALTER USER username SET statement_timeout TO 600000;
In the preceding command, username indicates the user name of the database for which the SQL statement timeout interval is to be set.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.