This topic describes the hint syntax for specifying a time-out period for SQL statements.
Information provided in this topic is applicable to Distributed Relational Database Service (DRDS) V5.3 and later.
In DRDS, the default time-out period for the SQL statements in DRDS instances and ApsaraDB RDS instances is 900 seconds. You can change the time-out period based on your requirements. Some SQL statements may take longer than 900 seconds to complete. For these slow SQL statements, DRDS provides a custom hint that you can use to change the time-out period for these statements. You can use this custom hint to change the time-out period for SQL statements.
The value specified by
SOCKET_TIMEOUT is measured in milliseconds. You can use this custom hint to change the time-out
period for SQL statements based on your business requirements.
- DRDS custom hints can be specified in the
/*+TDDL:hint_command*/format or in the
- If you specify custom hints in the
-cparameter to the command used to log on to the MySQL command-line client: mysql. This way, you can execute SQL statements that contain the DRDS custom hints on the client. If you do not add the -c parameter,the client deletes comments in SQL statements before it sends the SQL statements to servers for execution. DRDS custom hints in this format are defined as MySQL comments. Therefore,the DRDS custom hints cannot take effect. For more information, see mysql client options.
Set the time-out period of SQL statements to 40 seconds:
/*+TDDL:SOCKET_TIMEOUT(40000)*/SELECT * FROM t_item;