summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/innodb/t/innodb-analyze.test
blob: db699ad41a0dd783d5728c4de707d3cc3c6894c6 (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
--source include/have_innodb.inc
#
# Test that mysqld does not crash when running ANALYZE TABLE with
# different values of the parameter innodb_stats_transient_sample_pages.
#

# we care only that the following SQL commands do not produce errors
# and do not crash the server
-- disable_query_log
-- enable_warnings

SET @save_sample_pages = @@GLOBAL.innodb_stats_transient_sample_pages;
SET GLOBAL innodb_stats_transient_sample_pages=0;
SHOW VARIABLES LIKE 'innodb_stats_transient_sample_pages';
-- disable_result_log

CREATE TABLE innodb_analyze (
	a INT,
	b INT,
	KEY(a),
	KEY(b,a)
) ENGINE=InnoDB;

# test with empty table

ANALYZE TABLE innodb_analyze;

SET GLOBAL innodb_stats_transient_sample_pages=2;
ANALYZE TABLE innodb_analyze;

SET GLOBAL innodb_stats_transient_sample_pages=4;
ANALYZE TABLE innodb_analyze;

SET GLOBAL innodb_stats_transient_sample_pages=8;
ANALYZE TABLE innodb_analyze;

SET GLOBAL innodb_stats_transient_sample_pages=16;
ANALYZE TABLE innodb_analyze;

INSERT INTO innodb_analyze VALUES
(1,1), (1,1), (1,2), (1,3), (1,4), (1,5),
(8,1), (8,8), (8,2), (7,1), (1,4), (3,5);

SET GLOBAL innodb_stats_transient_sample_pages=1;
ANALYZE TABLE innodb_analyze;

SET GLOBAL innodb_stats_transient_sample_pages=2;
ANALYZE TABLE innodb_analyze;

SET GLOBAL innodb_stats_transient_sample_pages=4;
ANALYZE TABLE innodb_analyze;

SET GLOBAL innodb_stats_transient_sample_pages=8;
ANALYZE TABLE innodb_analyze;

SET GLOBAL innodb_stats_transient_sample_pages=16;
ANALYZE TABLE innodb_analyze;

DROP TABLE innodb_analyze;
SET GLOBAL innodb_stats_transient_sample_pages = @save_sample_pages;