mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Added missing tests for innodb persistent statistics (from mysql-5.6.10)
Made sure that innodb tables for persistent statistics would not considered by the server as system tables.
This commit is contained in:
145
mysql-test/suite/innodb/r/innodb_stats_fetch.result
Normal file
145
mysql-test/suite/innodb/r/innodb_stats_fetch.result
Normal file
@ -0,0 +1,145 @@
|
||||
CREATE TABLE test_ps_fetch
|
||||
(a INT, b INT, c INT, d INT, PRIMARY KEY (a, b), INDEX idx (c, d))
|
||||
ENGINE=INNODB STATS_PERSISTENT=1;
|
||||
ANALYZE TABLE test_ps_fetch;
|
||||
Table test.test_ps_fetch
|
||||
Op analyze
|
||||
Msg_type status
|
||||
Msg_text OK
|
||||
SELECT n_rows, clustered_index_size, sum_of_other_index_sizes
|
||||
FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch';
|
||||
n_rows 0
|
||||
clustered_index_size 1
|
||||
sum_of_other_index_sizes 1
|
||||
SELECT index_name, stat_name, stat_value, sample_size, stat_description
|
||||
FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_fetch'
|
||||
ORDER BY index_name, stat_name;
|
||||
index_name PRIMARY
|
||||
stat_name n_diff_pfx01
|
||||
stat_value 0
|
||||
sample_size 1
|
||||
stat_description a
|
||||
index_name PRIMARY
|
||||
stat_name n_diff_pfx02
|
||||
stat_value 0
|
||||
sample_size 1
|
||||
stat_description a,b
|
||||
index_name PRIMARY
|
||||
stat_name n_leaf_pages
|
||||
stat_value 1
|
||||
sample_size NULL
|
||||
stat_description Number of leaf pages in the index
|
||||
index_name PRIMARY
|
||||
stat_name size
|
||||
stat_value 1
|
||||
sample_size NULL
|
||||
stat_description Number of pages in the index
|
||||
index_name idx
|
||||
stat_name n_diff_pfx01
|
||||
stat_value 0
|
||||
sample_size 1
|
||||
stat_description c
|
||||
index_name idx
|
||||
stat_name n_diff_pfx02
|
||||
stat_value 0
|
||||
sample_size 1
|
||||
stat_description c,d
|
||||
index_name idx
|
||||
stat_name n_diff_pfx03
|
||||
stat_value 0
|
||||
sample_size 1
|
||||
stat_description c,d,a
|
||||
index_name idx
|
||||
stat_name n_diff_pfx04
|
||||
stat_value 0
|
||||
sample_size 1
|
||||
stat_description c,d,a,b
|
||||
index_name idx
|
||||
stat_name n_leaf_pages
|
||||
stat_value 1
|
||||
sample_size NULL
|
||||
stat_description Number of leaf pages in the index
|
||||
index_name idx
|
||||
stat_name size
|
||||
stat_value 1
|
||||
sample_size NULL
|
||||
stat_description Number of pages in the index
|
||||
SELECT index_name, seq_in_index, column_name, cardinality
|
||||
FROM information_schema.statistics WHERE table_name = 'test_ps_fetch'
|
||||
ORDER BY index_name, seq_in_index;
|
||||
index_name idx
|
||||
seq_in_index 1
|
||||
column_name c
|
||||
cardinality 0
|
||||
index_name idx
|
||||
seq_in_index 2
|
||||
column_name d
|
||||
cardinality 0
|
||||
index_name PRIMARY
|
||||
seq_in_index 1
|
||||
column_name a
|
||||
cardinality 0
|
||||
index_name PRIMARY
|
||||
seq_in_index 2
|
||||
column_name b
|
||||
cardinality 0
|
||||
SELECT
|
||||
table_rows, avg_row_length, max_data_length, index_length
|
||||
FROM information_schema.tables WHERE table_name = 'test_ps_fetch';
|
||||
table_rows 0
|
||||
avg_row_length 0
|
||||
max_data_length 0
|
||||
index_length 16384
|
||||
UPDATE mysql.innodb_table_stats SET
|
||||
n_rows = 1000,
|
||||
clustered_index_size = 5
|
||||
WHERE
|
||||
table_name = 'test_ps_fetch';
|
||||
UPDATE mysql.innodb_index_stats SET
|
||||
stat_value = 20
|
||||
WHERE
|
||||
table_name = 'test_ps_fetch' AND
|
||||
index_name = 'PRIMARY' AND
|
||||
stat_name = 'n_diff_pfx01';
|
||||
UPDATE mysql.innodb_index_stats SET
|
||||
stat_value = 90
|
||||
WHERE
|
||||
table_name = 'test_ps_fetch' AND
|
||||
index_name = 'PRIMARY' AND
|
||||
stat_name = 'n_diff_pfx02';
|
||||
UPDATE mysql.innodb_index_stats SET
|
||||
stat_value = 3
|
||||
WHERE
|
||||
table_name = 'test_ps_fetch' AND
|
||||
index_name = 'idx' AND
|
||||
stat_name = 'n_diff_pfx01';
|
||||
UPDATE mysql.innodb_index_stats SET
|
||||
stat_value = 11
|
||||
WHERE
|
||||
table_name = 'test_ps_fetch' AND
|
||||
index_name = 'idx' AND
|
||||
stat_name = 'n_diff_pfx02';
|
||||
FLUSH TABLE test_ps_fetch;
|
||||
SELECT seq_in_index, column_name, cardinality
|
||||
FROM information_schema.statistics WHERE table_name = 'test_ps_fetch'
|
||||
ORDER BY index_name, seq_in_index;
|
||||
seq_in_index 1
|
||||
column_name c
|
||||
cardinality 6
|
||||
seq_in_index 2
|
||||
column_name d
|
||||
cardinality 22
|
||||
seq_in_index 1
|
||||
column_name a
|
||||
cardinality 40
|
||||
seq_in_index 2
|
||||
column_name b
|
||||
cardinality 200
|
||||
SELECT
|
||||
table_rows, avg_row_length, max_data_length, index_length
|
||||
FROM information_schema.tables WHERE table_name = 'test_ps_fetch';
|
||||
table_rows 1000
|
||||
avg_row_length 81
|
||||
max_data_length 0
|
||||
index_length 16384
|
||||
DROP TABLE test_ps_fetch;
|
Reference in New Issue
Block a user