File: stat_tables.result

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (113 lines) | stat: -rw-r--r-- 4,673 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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;
#
# MDEV-34207: ALTER TABLE...STATS_PERSISTENT=0 fails to drop statistics
#
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1;
ALTER TABLE t1 STATS_PERSISTENT 0;
DROP TABLE t1;
SET @save_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=1;
CREATE TABLE t2 (c1 INT) ENGINE=InnoDB;
RENAME TABLE t2 TO t1;
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent=0;
CREATE TABLE t2 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1;
RENAME TABLE t2 TO t1;
SET GLOBAL innodb_stats_persistent=@save_persistent;
DROP TABLE t1;
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1;
DROP TABLE t1;
# End of 10.6 tests
#
# MDEV-36373 Warning: ... persistent statistics storage is corrupted
#
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
SET STATEMENT transaction_read_only=1 FOR ANALYZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	Engine-independent statistics collected
test.t1	analyze	status	OK
DROP TABLE t1;
# End of 10.11 tests