LP #1449440: when drop a table, TABLE_STATISTICS not clean it.
Description
Environment
Smart Checklist
Activity

Julia Vural March 4, 2025 at 9:22 PM
It appears that this issue is no longer being worked on, so we are closing it for housekeeping purposes. If you believe the issue still exists, please open a new ticket after confirming it's present in the latest release.

lpjirasync January 22, 2018 at 11:46 AM
**Comment from Launchpad by: Nilnandan Joshi on: 19-08-2015 06:15:57
Verified with 5.5
nilnandan.joshi@bm-support01:~$ mysql -uroot -p --socket=/tmp/mysql_sandbox5544.sock
Warning: Using unique option prefix pass instead of password is deprecated and will be removed in a future release. Please use the full name instead.
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.44-37.3 Percona Server (GPL), Release 37.3, Revision 729fbe2
Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
--------------------
Database |
--------------------
information_schema |
mysql |
performance_schema |
test |
--------------------
4 rows in set (0.13 sec)
mysql> use test
Database changed
mysql> show variables like 'userstat';
----------------------+
Variable_name | Value |
----------------------+
userstat | OFF |
----------------------+
1 row in set (0.02 sec)
mysql> set global userstat=ON;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'userstat';
----------------------+
Variable_name | Value |
----------------------+
userstat | ON |
----------------------+
1 row in set (0.00 sec)
mysql> create table tu(id int primary key);
Query OK, 0 rows affected (0.12 sec)
mysql> insert into tu values(1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from information_schema.table_statistics\G
*************************** 1. row ***************************
TABLE_SCHEMA: test
TABLE_NAME: tu
ROWS_READ: 0
ROWS_CHANGED: 3
ROWS_CHANGED_X_INDEXES: 3
1 row in set (0.00 sec)
mysql> drop table tu;
Query OK, 0 rows affected (0.01 sec)
mysql> select * from information_schema.table_statistics\G
*************************** 1. row ***************************
TABLE_SCHEMA: test
TABLE_NAME: tu
ROWS_READ: 0
ROWS_CHANGED: 3
ROWS_CHANGED_X_INDEXES: 3
1 row in set (0.00 sec)
mysql>

lpjirasync January 22, 2018 at 11:46 AM
**Comment from Launchpad by: Elena Stepanova on: 18-08-2015 21:56:47
If you ever get to fixing it, please note it's the same for index statistics after dropping an index, see MDEV-8633.

lpjirasync January 22, 2018 at 11:46 AM
**Comment from Launchpad by: Valerii Kravchuk on: 28-04-2015 16:54:50
This is really easy to confirm:
[openxs@centos ~]$ mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-72.1-log Percona Server (GPL), Release 72.1, Revision 0503478
Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like 'userstat';
----------------------+
Variable_name | Value |
----------------------+
userstat | OFF |
----------------------+
1 row in set (0.00 sec)
mysql> set global userstat=ON;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'userstat';
----------------------+
Variable_name | Value |
----------------------+
userstat | ON |
----------------------+
1 row in set (0.00 sec)
mysql> create table tu(id int primary key);
Query OK, 0 rows affected (0.23 sec)
mysql> insert into tu values(1),(2),(3);
Query OK, 3 rows affected (0.06 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from information_schema.table_statistics\G
*************************** 1. row ***************************
TABLE_SCHEMA: test
TABLE_NAME: tu
ROWS_READ: 0
ROWS_CHANGED: 3
ROWS_CHANGED_X_INDEXES: 3
1 row in set (0.00 sec)
mysql> drop table tu;
Query OK, 0 rows affected (0.05 sec)
mysql> select * from information_schema.table_statistics\G
*************************** 1. row ***************************
TABLE_SCHEMA: test
TABLE_NAME: tu
ROWS_READ: 0
ROWS_CHANGED: 3
ROWS_CHANGED_X_INDEXES: 3
1 row in set (0.00 sec)
Details
Assignee
UnassignedUnassignedReporter
lpjirasynclpjirasync(Deactivated)Labels
Priority
High
Details
Details
Assignee
Reporter

Labels
Priority
Smart Checklist
Open Smart Checklist
Smart Checklist
Open Smart Checklist
Smart Checklist

**Reported in Launchpad by rj03hou last update 20-08-2015 05:00:29
rt, I think is easy to fix it.