summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result
blob: 75fe06e2faf0f037eb4ab2e0445944ab16bd1332 (plain)
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
'#--------------------FN_DYNVARS_097_01-------------------------#'
SET @start_value = @@global.myisam_stats_method;
SET @@global.myisam_stats_method = nulls_equal;
connect  con1,localhost,root,,,,;
connection con1;
SELECT @@global.myisam_stats_method;
@@global.myisam_stats_method
NULLS_EQUAL
SELECT @@session.myisam_stats_method;
@@session.myisam_stats_method
NULLS_EQUAL
disconnect con1;
'#--------------------FN_DYNVARS_097_02-------------------------#'
connection default;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT, KEY (a));
INSERT INTO t1 VALUES (0),(1),(2),(3),(4);
INSERT INTO t1 SELECT NULL FROM t1;
'default: NULLs considered unequal'
SET myisam_stats_method = nulls_unequal;
ANALYZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	Engine-independent statistics collected
test.t1	analyze	status	OK
SHOW INDEX FROM t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
t1	1	a	1	a	A	10	NULL	NULL	YES	BTREE		
INSERT INTO t1 VALUES (11);
DELETE FROM t1 WHERE a = 11;
CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
SHOW INDEX FROM t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
t1	1	a	1	a	A	10	NULL	NULL	YES	BTREE		
'Set nulls to be equal'
SET myisam_stats_method = nulls_equal;
INSERT INTO t1 VALUES (11);
DELETE FROM t1 WHERE a = 11;
ANALYZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	Engine-independent statistics collected
test.t1	analyze	status	OK
SHOW INDEX FROM t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
t1	1	a	1	a	A	5	NULL	NULL	YES	BTREE		
INSERT INTO t1 VALUES (11);
DELETE FROM t1 WHERE a = 11;
CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
SHOW INDEX FROM t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
t1	1	a	1	a	A	10	NULL	NULL	YES	BTREE		
'Set nulls to be ignored'
SET myisam_stats_method = nulls_ignored;
SHOW VARIABLES LIKE 'myisam_stats_method';
Variable_name	Value
myisam_stats_method	NULLS_IGNORED
DROP TABLE t1;
CREATE TABLE t1 (
a CHAR(3), b CHAR(4), c CHAR(5), d CHAR(6),
KEY(a,b,c,d)
);
INSERT INTO t1 VALUES ('bcd','def1', NULL, 'zz');
INSERT INTO t1 VALUES ('bcd','def2', NULL, 'zz');
INSERT INTO t1 VALUES ('bce','def1', 'yuu', NULL);
INSERT INTO t1 VALUES ('bce','def2', NULL, 'quux');
ANALYZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	Engine-independent statistics collected
test.t1	analyze	status	OK
SHOW INDEX FROM t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
t1	1	a	1	a	A	2	NULL	NULL	YES	BTREE		
t1	1	a	2	b	A	4	NULL	NULL	YES	BTREE		
t1	1	a	3	c	A	4	NULL	NULL	YES	BTREE		
t1	1	a	4	d	A	4	NULL	NULL	YES	BTREE		
DELETE FROM t1;
ANALYZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	Engine-independent statistics collected
test.t1	analyze	status	OK
SHOW INDEX FROM t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
t1	1	a	2	b	A	0	NULL	NULL	YES	BTREE		
t1	1	a	3	c	A	0	NULL	NULL	YES	BTREE		
t1	1	a	4	d	A	0	NULL	NULL	YES	BTREE		
SET myisam_stats_method = DEFAULT;
DROP TABLE t1;
SET @@global.myisam_stats_method= @start_value;