------------------------------------------------------------------------------------ mysql> DESC user_account; +-----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+------------------+------+-----+---------+----------------+ | USERID | int(10) unsigned | NO | PRI | NULL | auto_increment | | USERNAME | varchar(10) | NO | | NULL | | | PASSSWORD | varchar(30) | NO | | NULL | | | GROUPNAME | varchar(10) | YES | | NULL | | +-----------+------------------+------+-----+---------+----------------+ 4 rows in set (0.00 sec) mysql> select * from user_account PROCEDURE ANALYSE(1)\G; *************************** 1. row *************************** Field_name: ibatis.user_account.USERID Min_value: 1 Max_value: 103 Min_length: 1 Max_length: 3 Empties_or_zeros: 0 Nulls: 0 Avg_value_or_avg_length: 51.7500 Std: 50.2562 Optimal_fieldtype: TINYINT(3) UNSIGNED NOT NULL *************************** 2. row *************************** Field_name: ibatis.user_account.USERNAME Min_value: dfsa Max_value: LMEADORS ......................................................... ---------------------------------------------------------------------------------------
從第一行輸出我們可以看到analyze分析ibatis.user_account.USERID列最小值1,最大值103,最小長度1, 最大長度3...,並給出了改字段的優化建議:建議將該字段的數據類型改成TINYINT(3) UNSIGNED NOT NULL。