This topic describes the hint syntax for specifying a time-out period for SQL statements.
Information provided in this topic is applicable to PolarDB-X 1.0 V5.3 and later.
In PolarDB-X 1.0, the default time-out period for the SQL statements in PolarDB-X 1.0 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, PolarDB-X 1.0 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.
- PolarDB-X 1.0 custom hints can be specified in the
/*+TDDL:hint_command*/format or in the
- If you specify custom hints in the
/*+TDDL:hint_command*/format, add 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 PolarDB-X 1.0 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. PolarDB-X 1.0 custom hints in this format are defined as MySQL comments. Therefore, the PolarDB-X 1.0 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;