[memo] MySQL PROCEDURE ANALYSE / schema 分析 / performance running

SELECT * FROM SYS_USER PROCEDURE ANALYSE() \G;

 

 

URL : http://dev.mysql.com/doc/refman/5.0/en/procedure-analyse.html

 

---
select s1 from tbl_0001
procedure analyse();

+---------------------+-----------+-----------+------------+------------+------------------+-------+-------------------------+--------+------------------------+
| Field_name          | Min_value | Max_value | Min_length | Max_length | Empties_or_zeros | Nulls | Avg_value_or_avg_length | Std    | Optimal_fieldtype      |
+---------------------+-----------+-----------+------------+------------+------------------+-------+-------------------------+--------+------------------------+
| db_item.tbl_0001.s1 | 0         | 1         |          1 |          1 |           483461 |     0 | 0.2651                  | 0.4414 | ENUM('0','1') NOT NULL |
+---------------------+-----------+-----------+------------+------------+------------------+-------+-------------------------+--------+------------------------+

mysql> select count(1) from tbl_0001;
+----------+
| count(1) |
+----------+
|   657829 |
+----------+
1 row in set (0.19 sec)

mysql> select s1,count(1) from tbl_0001 group by s1;
+----+----------+
| s1 | count(1) |
+----+----------+
|  0 |   483461 |
|  1 |   174368 |
+----+----------+
2 rows in set (0.36 sec)