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
TiDB cannot delete the old partition stats after changing one table from a partitioned table to a non-partitioned table.
create table ht(a int, b varchar(10), index idx_b (b)) partition by hash(a) partitions 3;
insert into ht values (1, "a"), (2, "b"), (3, "c");
select * from mysql.stats_meta;
mysql> select * from mysql.stats_meta; +--------------------+----------+--------------+-------+----------+ | version | table_id | modify_count | count | snapshot | +--------------------+----------+--------------+-------+----------+ | 445471591002800132 | 103 | 1 | 1 | 0 | | 445471591002800141 | 104 | 1 | 1 | 0 | | 445471591002800146 | 105 | 1 | 1 | 0 | | 445471591002800146 | 102 | 3 | 3 | 0 | +--------------------+----------+--------------+-------+----------+ 4 rows in set (0.01 sec)
alter table ht remove PARTITIONING;
mysql> select * from mysql.stats_meta; +--------------------+----------+--------------+-------+----------+ | version | table_id | modify_count | count | snapshot | +--------------------+----------+--------------+-------+----------+ | 445471591002800132 | 103 | 1 | 1 | 0 | | 445471591002800141 | 104 | 1 | 1 | 0 | | 445471591002800146 | 105 | 1 | 1 | 0 | | 445471591002800146 | 107 | 3 | 3 | 0 | +--------------------+----------+--------------+-------+----------+ 4 rows in set (0.00 sec) mysql> show stats_meta; +---------+------------+----------------+---------------------+--------------+-----------+ | Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count | +---------+------------+----------------+---------------------+--------------+-----------+ | test | ht | | 2023-11-07 14:41:00 | 3 | 3 | +---------+------------+----------------+---------------------+--------------+-----------+ 1 row in set (0.00 sec)
Delete the old partition's stats.
Nothing happened.
mysql> select tidb_version(); +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | tidb_version() | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Release Version: v7.6.0-alpha-69-gbf8c728934 Edition: Community Git Commit Hash: bf8c728934c7376765ddd943fd302fcb65af4bf0 Git Branch: master UTC Build Time: 2023-11-01 08:29:41 GoVersion: go1.21.1 Race Enabled: false Check Table Before Drop: false Store: tikv | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
The text was updated successfully, but these errors were encountered:
statistics: delete old partition's stats meta after removing partitio…
8bebe44
…ning (#49553) close #49547
Rustin170506
Successfully merging a pull request may close this issue.
Bug Report
TiDB cannot delete the old partition stats after changing one table from a partitioned table to a non-partitioned table.
1. Minimal reproduce step (Required)
create table ht(a int, b varchar(10), index idx_b (b)) partition by hash(a) partitions 3;
insert into ht values (1, "a"), (2, "b"), (3, "c");
select * from mysql.stats_meta;
alter table ht remove PARTITIONING;
select * from mysql.stats_meta;
select * from mysql.stats_meta;
2. What did you expect to see? (Required)
Delete the old partition's stats.
3. What did you see instead (Required)
Nothing happened.
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: