when drop a table, TABLE_STATISTICS not clean it.

Bug #1449440 reported by rj03hou
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Triaged
Medium
Unassigned
5.6
Triaged
Medium
Unassigned
5.7
Triaged
Medium
Unassigned

Bug Description

rt, I think is easy to fix it.

Tags: userstat
tags: added: userstat
Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

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)

Revision history for this message
Elena Stepanova (elenst) wrote :

If you ever get to fixing it, please note it's the same for index statistics after dropping an index, see MDEV-8633.

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :

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>

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1622

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.