We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repeatedly updating the same row will cause the stats_healthy to become low, which affects the correctness of the execution plan
mysql> create table t(a int); mysql> insert into t values(1),(1),(1),(1),(1),(1),(1),(1); Query OK, 8 row affected (0.01 sec) mysql> show stats_meta where table_name='t'; +---------+------------+----------------+---------------------+--------------+-----------+ | Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | +---------+------------+----------------+---------------------+--------------+-----------+ | test | t | | 2023-10-10 16:36:50 | 0 | 8 | +---------+------------+----------------+---------------------+--------------+-----------+ 1 row in set (0.00 sec) mysql> update t set a=2 where a=1 limit 1; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: mysql> update t set a=3 where a=2 limit 1; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from t; +------+ | a | +------+ | 3 | | 1 | | 1 | | 1 | | 1 | | 1 | | 1 | | 1 | +------+ 8 rows in set (0.00 sec) mysql> update t set a=4 where a=3 limit 1; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0
mysql> show stats_meta where table_name='t'; +---------+------------+----------------+---------------------+--------------+-----------+ | Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | +---------+------------+----------------+---------------------+--------------+-----------+ | test | t | | 2023-10-10 16:40:47 | 1 | 8 | +---------+------------+----------------+---------------------+--------------+-----------+ 1 row in set (0.00 sec) mysql> show stats_healthy where table_name='t'; +---------+------------+----------------+---------+ | Db_name | Table_name | Partition_name | Healthy | +---------+------------+----------------+---------+ | test | t | | 88 | +---------+------------+----------------+---------+ 1 row in set (0.00 sec)
mysql> show stats_meta where table_name='t'; +---------+------------+----------------+---------------------+--------------+-----------+ | Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | +---------+------------+----------------+---------------------+--------------+-----------+ | test | t | | 2023-10-10 16:40:47 | 3 | 8 | +---------+------------+----------------+---------------------+--------------+-----------+ 1 row in set (0.00 sec) mysql> show stats_healthy where table_name='t'; +---------+------------+----------------+---------+ | Db_name | Table_name | Partition_name | Healthy | +---------+------------+----------------+---------+ | test | t | | 12 | +---------+------------+----------------+---------+ 1 row in set (0.00 sec)
v6.5.3
The text was updated successfully, but these errors were encountered:
planner: adjust estimated rows to account for modified rows (#50970)
47a990e
close #47523
Successfully merging a pull request may close this issue.
Report
Repeatedly updating the same row will cause the stats_healthy to become low, which affects the correctness of the execution plan
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
v6.5.3
The text was updated successfully, but these errors were encountered: