summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/innodb/r/stat_tables.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/innodb/r/stat_tables.result')
-rw-r--r--mysql-test/suite/innodb/r/stat_tables.result85
1 files changed, 85 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result
new file mode 100644
index 00000000..99c862fe
--- /dev/null
+++ b/mysql-test/suite/innodb/r/stat_tables.result
@@ -0,0 +1,85 @@
+rename table mysql.table_stats to mysql.table_stats_save;
+flush tables;
+set use_stat_tables= PREFERABLY;
+create table t1 (a int) engine=InnoDB;
+start transaction;
+insert t1 values (1);
+insert t1 values (2);
+commit;
+select * from t1;
+a
+1
+2
+drop table t1;
+rename table mysql.table_stats_save to mysql.table_stats;
+flush tables;
+#
+# MDEV-26753 Assertion state == TRX_STATE_PREPARED ||... failed
+#
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+XA START 'test';
+SELECT COUNT(*)>0 FROM mysql.innodb_index_stats LOCK IN SHARE MODE;
+COUNT(*)>0
+1
+INSERT INTO t1 VALUES (1),(2);
+UPDATE mysql.innodb_table_stats SET last_update=NULL WHERE table_name='t1';
+XA END 'test';
+XA ROLLBACK 'test';
+DROP TABLE t1;
+#
+# MDEV-30483 After upgrade to 10.6 from Mysql 5.7 seeing "InnoDB: Column last_update in table mysql.innodb_table_stats is BINARY(4) NOT NULL but should be INT UNSIGNED NOT NULL"
+#
+#
+# Testing a non-default format: Field_timestamp0 - UINT4 based
+#
+SET @@global.mysql56_temporal_format=0;
+ALTER TABLE mysql.innodb_table_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp();
+ALTER TABLE mysql.innodb_index_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp();
+SHOW COLUMNS FROM mysql.innodb_table_stats LIKE 'last_update';
+Field Type Null Key Default Extra
+last_update timestamp /* mariadb-5.3 */ NO current_timestamp() on update current_timestamp()
+SHOW COLUMNS FROM mysql.innodb_index_stats LIKE 'last_update';
+Field Type Null Key Default Extra
+last_update timestamp /* mariadb-5.3 */ NO current_timestamp() on update current_timestamp()
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1;
+SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_table_stats
+WHERE database_name='test' AND table_name='t1';
+TIMESTAMPDIFF(DAY,last_update,now())<=1
+1
+SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_index_stats
+WHERE database_name='test' AND table_name='t1' AND stat_name='size';
+TIMESTAMPDIFF(DAY,last_update,now())<=1
+1
+DROP TABLE t1;
+#
+# Now as the table t1 is dropped, expect no statistics
+#
+SELECT * FROM mysql.innodb_table_stats
+WHERE database_name='test' AND table_name='t1';
+database_name table_name last_update n_rows clustered_index_size sum_of_other_index_sizes
+SELECT * FROM mysql.innodb_index_stats
+WHERE database_name='test' AND table_name='t1' AND stat_name='size';
+database_name table_name index_name last_update stat_name stat_value sample_size stat_description
+#
+# Testing with the default format: Field_timestampf - BINARY(4) based with the UNSIGNED_FLAG
+#
+SET @@global.mysql56_temporal_format=1;
+ALTER TABLE mysql.innodb_table_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp();
+ALTER TABLE mysql.innodb_index_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp();
+SHOW COLUMNS FROM mysql.innodb_table_stats LIKE 'last_update';
+Field Type Null Key Default Extra
+last_update timestamp NO current_timestamp() on update current_timestamp()
+SHOW COLUMNS FROM mysql.innodb_index_stats LIKE 'last_update';
+Field Type Null Key Default Extra
+last_update timestamp NO current_timestamp() on update current_timestamp()
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1;
+SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_table_stats
+WHERE database_name='test' AND table_name='t1';
+TIMESTAMPDIFF(DAY,last_update,now())<=1
+1
+SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_index_stats
+WHERE database_name='test' AND table_name='t1' AND stat_name='size';
+TIMESTAMPDIFF(DAY,last_update,now())<=1
+1
+DROP TABLE t1;
+# End of 10.6 tests