1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.11 into 11.0

This commit is contained in:
Marko Mäkelä
2023-10-19 08:12:16 +03:00
501 changed files with 15038 additions and 28950 deletions

View File

@ -562,14 +562,14 @@ test.t1 analyze Warning Engine-independent statistics are not collected for colu
test.t1 analyze status OK
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
test t1 pk 1 2 0.0000 4.0000 1.0000 NULL NULL NULL
DELETE FROM mysql.column_stats
WHERE db_name='test' AND table_name='t1' AND column_name='t';
INSERT INTO mysql.column_stats VALUES
('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL);
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
test t1 pk 1 2 0.0000 4.0000 1.0000 NULL NULL NULL
test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL
SELECT pk FROM t1;
pk
@ -593,7 +593,7 @@ pk c
2 bar
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
test t1 pk 1 2 0.0000 4.0000 1.0000 NULL NULL NULL
test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL
CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7));
SELECT * FROM t1;
@ -923,4 +923,82 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where
drop table t1;
set @@global.histogram_size=@save_histogram_size;
#
# End of 10.4 tests
#
#
# MDEV-29693 ANALYZE TABLE still flushes table definition cache
# when engine-independent statistics is used
#
create table t1 (a int);
insert into t1 select seq from seq_0_to_99;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
explain extended select count(*) from t1 where a < 50;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 100 50.51 Using where
Warnings:
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`a` < 50
connect con1, localhost, root,,;
connection con1;
explain extended select count(*) from t1 where a < 50;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 100 50.51 Using where
Warnings:
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`a` < 50
connection default;
update t1 set a= a +100;
# Explain shows outdated statistics:
explain extended select count(*) from t1 where a < 50;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 100 50.51 Using where
Warnings:
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`a` < 50
connection con1;
explain extended select count(*) from t1 where a < 50;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 100 50.51 Using where
Warnings:
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`a` < 50
connection default;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Now explain shows updated statistics:
explain extended select count(*) from t1 where a < 50;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 100 1.00 Using where
Warnings:
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`a` < 50
connection con1;
explain extended select count(*) from t1 where a < 50;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 100 1.00 Using where
Warnings:
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`a` < 50
connection con1;
# Run update and analyze in con1:
update t1 set a= a - 150;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
connection default;
# Explain shows updated statistics:
explain extended select count(*) from t1 where a < 50;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 Using where
Warnings:
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`a` < 50
disconnect con1;
drop table t1;
#
# End of 10.6 tests
#