Quick Start
Connect to MySQL
Databases
Tables
Adding Fields and Choosing Data Types
Customising Fields
Primary Keys and Indexes
Filter Wizard
Foreign Keys
Import/Export
Queries
Visual Query Builder
Stored Procedure
Data
Manage Users
Backup
Data Transfer
Schedule
Server Monitor
Maintaining your databases/tables
  Maintaining Your Databases/Tables
 

How to do it

Select the table you want to maintain, then click either Optimize Table, Analyze Table, Check Table or Repair Table from the Table menu to start the operation. Navicat will show all the resulting output of the operation.

NOTE: Navicat maintains the tables by issuing standard OPTIMIZE TABLE, CHECK TABLE, ANALYZE TABLE and REPAIR TABLE statements to the MySQL server. This is not supported in all versions of MySQL and is only applicable to MyISAM table types at this moment. Please refer to the MySQL documentations for more details on the isamchk and myisamchk command line utilities.

Optimize tables

The main reason for optimizing your table is to reclaim unused space in the table. You should optimize a table if you have deleted a large part of a table or if you have made many changes to a table with variable-length rows (tables that have VARCHAR, BLOB, or TEXT columns). Deleted records are maintained in a linked list and subsequent INSERT operations reuse old record positions.

Check tables

Check the table(s) for errors and update the key statistics for the table. The operation will have the following output:

Column Value
Table Table name.
Op Always "check".
Msg type One of status, error, info, or warning.
Msg text The message.

Note that you can get many rows of information for each checked table. The last row will be of Msg_type status and should normally be OK. If you don't get OK, or Not checked you should normally run a repair of the table. Not checked means that the table the given TYPE told MySQL that there wasn't any need to check the table. The different check types stand for the following:

Type Meaning
QUICK Don't scan the rows to check for wrong links.
FAST Only check tables which haven't been closed properly.
CHANGED Only check tables which have been changed since last check or haven't been closed properly.
EXTENDED Do a full key lookup for all keys for each row. This ensures that the table is 100 % consistent, but will take a long time!

Analyze tables

Analyze and store the key distribution for the table. During the analyze the table is locked with a read lock. This is equivalent of running myisamchk -a on the table. MySQL uses the stored key distribution to decide in which order tables should be joined when one does a join on something else than a constant.

The command returns a table with the following columns:

Column Value
Table Table name.
Op Always "analyze"
Msg type One of status, error, info, or warning.
Msg text The message.

You can check the stored key distribution with the SHOW INDEX command. If the table hasn't changed since the last ANALYZE TABLE command, the table will not be analyzed again.

Repair tables

Repair the corrupted table. The operation returns a table with the following columns:

Column Value
Table Table name.
Op Always "repair"
Msg type One of status, error, info, or warning.
Msg text The message.

Note that you can get many rows of information for each repaired table. The last one row will be of Msg type status and should normally be OK. If you don't get OK, you should try repairing the table with myisamchk -o, as REPAIR TABLE does not yet implement all the options of myisamchk. In the near future, we will make it more exible.

If you use QUICK then MySQL will try to do a repair of only the index tree.

If you use EXTENDED then MySQL will create the index row by row instead of creating one index at a time with sorting; This may be better than sorting on fixed length keys if you have long char() keys that compress very good.