当我插入数据时,会更新writer DB Indices统计信息 但是,不会更新Reader DB Indices统计信息。
示例就在这里。
数据库中。
create database test;
表。
CREATE TABLE test(
test_id INT NOT NULL PRIMARY KEY,
test_txt CHAR(8) DEFAULT NULL,
INDEX test_txt(test_txt)
);
作家。
mysql> insert into test values(1, 'test1');
Query OK, 1 row affected (0.01 sec)
mysql> show index from test;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| test | 0 | PRIMARY | 1 | test_id | A | 1 | NULL | NULL | | BTREE | | |
| test | 1 | test_txt | 1 | test_txt | A | 1 | NULL | NULL | YES | BTREE | | |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
2 rows in set (0.00 sec)
阅读器。
mysql> show index from test;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| test | 0 | PRIMARY | 1 | test_id | A | 0 | NULL | NULL | | BTREE | | |
| test | 1 | test_txt | 1 | test_txt | A | 0 | NULL | NULL | YES | BTREE | | |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
2 rows in set (0.00 sec)
为什么基数不仅仅更新了读者? 参数组是默认值。
请告诉我原因。