1SET @default_storage_engine_old = @@session.default_storage_engine; 2SET SESSION default_storage_engine = INNODB; 3FLUSH INDEX_STATISTICS; 4FLUSH TABLE_STATISTICS; 5SET @userstat_old= @@userstat; 6SET GLOBAL userstat=ON; 7CREATE TABLE t1 (id int(10), PRIMARY KEY (id)); 8INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); 9SELECT COUNT(*) FROM t1; 10COUNT(*) 1110 12SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; 13ROWS_READ 1410 15SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; 16ROWS_READ 1710 18FLUSH TABLE_STATISTICS; 19SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; 20ROWS_READ 21SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; 22ROWS_READ 2310 24FLUSH INDEX_STATISTICS; 25SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; 26ROWS_READ 27SELECT COUNT(*) FROM t1; 28COUNT(*) 2910 30SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1'; 31ROWS_READ 3210 33SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1'; 34ROWS_READ 3510 36DROP TABLE t1; 37CREATE TABLE t2 (c1 INT UNSIGNED); 38ALTER TABLE t2 MODIFY c1 FLOAT; 39SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; 40TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES 41DROP TABLE t2; 42CREATE TABLE t2 (c1 INT UNSIGNED); 43ALTER TABLE t2 MODIFY c1 FLOAT; 44SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2'; 45TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES 46DROP TABLE t2; 47SET GLOBAL userstat= @userstat_old; 48SET SESSION default_storage_engine = @default_storage_engine_old; 49