This topic describes how to perform table maintenance in DMS.
Optimize a table
To optimize a table, run the
optimize table <table_name> command. Right-click the target table and choose Table Structure > Optimize Table.Check a table
To check a table for errors, run the check table <table_name> command. This command supports the following options:
- fast: Does not scan rows to check for incorrect links.
- quick: Checks only improperly closed tables.
- changed: Checks only tables that have changed since the last check or were improperly closed.
- regular: Scans rows to verify that deleted links are valid and calculates a key checksum to validate all rows.
- extended: Performs a full check of every key in every row to ensure that the table is 100% consistent. This operation can be time-consuming.
Note Execution speed, from fastest to slowest: fast > quick > changed > regular > extended.
Repair a table
To repair a table, run the
repair table <table_name> command. In DMS, right-click the target table, choose Table Maintenance > Repair Table, and select one of the three repair modes: Regular, Quick, or Extended.- Regular: No option is specified. This is equivalent to running the
repair table <table_name>command, which performs a standard repair of the data and index files. - Quick: Uses the
quickoption. This is equivalent to runningrepair table <table_name> quick. As the fastest repair mode, it repairs only the index file, not the data file. - Extended: Uses the
extendedoption. This is equivalent to runningrepair table <table_name> extended. This mode recovers each row from the data file and rebuilds the indexes row by row, modifying both files in the process.
Note Execution speed, from fastest to slowest: Quick > Regular > Extended.
Analyze a table
To analyze and store the key distribution for a table, run the
analyze table <table_name> command. In the object tree, right-click the target table and choose Table Maintenance > Analyze Table.该文章对您有帮助吗?