Iteration1:
mysql> show table status LIKE "mybigusertable"; +-----------------+--------+---------+------------+---------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+--------------------------+ | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment | +-----------------+--------+---------+------------+---------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+--------------------------+ | mybigusertable | InnoDB | 10 | Compact | 3089655 | 1686 | 5209325568 | 0 | 797671424 | 0 | 3154997 | 2011-12-04 03:46:43 | NULL | NULL | utf8_unicode_ci | NULL | | InnoDB free: 13775872 kB | +-----------------+--------+---------+------------+---------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+--------------------------+ mysql> show index from mybigusertable; +-----------------+------------+-----------------+--------------+--------------------+-----------+-------------+----------+--------+------+------------+---------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | +-----------------+------------+-----------------+--------------+--------------------+-----------+-------------+----------+--------+------+------------+---------+ | mybigusertable | 0 | PRIMARY | 1 | someid | A | 3402091 | NULL | NULL | | BTREE
Iteration 2
mysql> show index from mybigusertable; +-----------------+------------+-----------------+--------------+--------------------+-----------+-------------+----------+--------+------+------------+---------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | +-----------------+------------+-----------------+--------------+--------------------+-----------+-------------+----------+--------+------+------------+---------+ | mybigusertable | 0 | PRIMARY | 1 | someid | A | 2811954 | NULL | NULL | | BTREE
The above time between the two above was less than 5 seconds. Why is there such a radical difference every time the show index is called?
This only happens with this table, I checked several large tables and they show the same numbers every time I access them
FYI number in table:
mysql> select count(*) from mybigusertable; +----------+ | count(*) | +----------+ | 3109320 | +----------+ 1 row in set (4 min 34.00 sec)
A few questions:
- Why does power change so much, and does it really matter?
- How important is Optimize a table ? and will he make requests faster?
source share