tencent cloud

TDSQL Boundless

OPTIMIZE TABLE

PDF
Focus Mode
Font Size
Last updated: 2026-04-03 16:45:14

Description

This statement performs compaction on the data range of the specified table. Its execution does not lock the table or block read and write requests.

Permission Requirements

SELECT and INSERT privileges.

Syntax

OPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL]
TABLE tbl_name [, tbl_name] ...

Parameter Description

Parameter
Required
Description
NO_WRITE_TO_BINLOG
Optional
Reserved keywords have no practical feature.
LOCAL
Optional
Reserved keywords have no practical feature.

Examples

tdsql> optimize table t1;
+---------+----------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------+----------+----------+----------+
| test.t1 | optimize | status | OK |
+---------+----------+----------+----------+
1 row in set (0.01 sec)

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback