Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9a06e531
Commit
9a06e531
authored
Mar 28, 2014
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
933c3a5e
92e49bb0
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
122 additions
and
0 deletions
+122
-0
mysql-test/r/selectivity.result
mysql-test/r/selectivity.result
+32
-0
mysql-test/r/selectivity_innodb.result
mysql-test/r/selectivity_innodb.result
+32
-0
mysql-test/r/selectivity_no_engine.result
mysql-test/r/selectivity_no_engine.result
+3
-0
mysql-test/r/stat_tables.result
mysql-test/r/stat_tables.result
+5
-0
mysql-test/r/stat_tables_innodb.result
mysql-test/r/stat_tables_innodb.result
+5
-0
mysql-test/r/stat_tables_par.result
mysql-test/r/stat_tables_par.result
+1
-0
mysql-test/r/stat_tables_par_innodb.result
mysql-test/r/stat_tables_par_innodb.result
+1
-0
mysql-test/r/stat_tables_partition.result
mysql-test/r/stat_tables_partition.result
+1
-0
mysql-test/r/stat_tables_rbr.result
mysql-test/r/stat_tables_rbr.result
+2
-0
mysql-test/r/stat_tables_repl.result
mysql-test/r/stat_tables_repl.result
+5
-0
mysql-test/r/statistics.result
mysql-test/r/statistics.result
+24
-0
sql/sql_admin.cc
sql/sql_admin.cc
+11
-0
No files found.
mysql-test/r/selectivity.result
View file @
9a06e531
...
@@ -16,6 +16,7 @@ insert into t1 values
...
@@ -16,6 +16,7 @@ insert into t1 values
(9), (3), (2), (NULL), (NULL), (2), (NULL), (1), (5), (NULL);
(9), (3), (2), (NULL), (NULL), (2), (NULL), (1), (5), (NULL);
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
select * from mysql.column_stats;
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
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
...
@@ -567,6 +568,7 @@ Supplier#000000010 Saygah3gYWMp72i PY
...
@@ -567,6 +568,7 @@ Supplier#000000010 Saygah3gYWMp72i PY
set histogram_size=127;
set histogram_size=127;
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
dbt3_s001.part analyze status Engine-independent statistics collected
dbt3_s001.part analyze status Table is already up to date
dbt3_s001.part analyze status Table is already up to date
flush table part;
flush table part;
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=4;
...
@@ -622,6 +624,7 @@ set histogram_type='DOUBLE_PREC_HB';
...
@@ -622,6 +624,7 @@ set histogram_type='DOUBLE_PREC_HB';
set histogram_size=126;
set histogram_size=126;
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
dbt3_s001.part analyze status Engine-independent statistics collected
dbt3_s001.part analyze status Table is already up to date
dbt3_s001.part analyze status Table is already up to date
flush table part;
flush table part;
EXPLAIN EXTENDED select sql_calc_found_rows
EXPLAIN EXTENDED select sql_calc_found_rows
...
@@ -676,6 +679,7 @@ set histogram_type='SINGLE_PREC_HB';
...
@@ -676,6 +679,7 @@ set histogram_type='SINGLE_PREC_HB';
set histogram_size=24;
set histogram_size=24;
ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
dbt3_s001.nation analyze status Engine-independent statistics collected
dbt3_s001.nation analyze status Table is already up to date
dbt3_s001.nation analyze status Table is already up to date
flush table nation;
flush table nation;
EXPLAIN EXTENDED select sql_calc_found_rows
EXPLAIN EXTENDED select sql_calc_found_rows
...
@@ -821,6 +825,7 @@ set histogram_size=127;
...
@@ -821,6 +825,7 @@ set histogram_size=127;
set histogram_type='SINGLE_PREC_HB';
set histogram_type='SINGLE_PREC_HB';
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
flush table t1;
flush table t1;
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=4;
...
@@ -888,6 +893,7 @@ CREATE TABLE t1 (a int);
...
@@ -888,6 +893,7 @@ CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (9), (1);
INSERT INTO t1 VALUES (9), (1);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -915,7 +921,9 @@ CREATE TABLE t2 (c int);
...
@@ -915,7 +921,9 @@ CREATE TABLE t2 (c int);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
ANALYZE TABLE t1, t2;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -942,6 +950,7 @@ CREATE TABLE t1 (a varchar(1));
...
@@ -942,6 +950,7 @@ CREATE TABLE t1 (a varchar(1));
INSERT INTO t1 VALUES ('x'), ('y');
INSERT INTO t1 VALUES ('x'), ('y');
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -962,7 +971,9 @@ CREATE TABLE t2 (b int);
...
@@ -962,7 +971,9 @@ CREATE TABLE t2 (b int);
INSERT INTO t2 VALUES (4),(5),(2),(5),(1),(1),(2);
INSERT INTO t2 VALUES (4),(5),(2),(5),(1),(1),(2);
ANALYZE TABLE t1, t2;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -988,6 +999,7 @@ INSERT INTO t1 VALUES
...
@@ -988,6 +999,7 @@ INSERT INTO t1 VALUES
(1),(7),(4),(7),(NULL),(2),(NULL),(4),(NULL),(NULL),(1),(3),(8),(8);
(1),(7),(4),(7),(NULL),(2),(NULL),(4),(NULL),(NULL),(1),(3),(8),(8);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
FLUSH TABLE t1;
FLUSH TABLE t1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -1035,8 +1047,11 @@ INSERT INTO t3 VALUES
...
@@ -1035,8 +1047,11 @@ INSERT INTO t3 VALUES
('brown'),('taylor'),('anderson'),('taylor');
('brown'),('taylor'),('anderson'),('taylor');
ANALYZE TABLE t1, t2, t3;
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t3 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=4;
...
@@ -1060,8 +1075,11 @@ CREATE TABLE t3 (c VARCHAR(8), d VARCHAR(8));
...
@@ -1060,8 +1075,11 @@ CREATE TABLE t3 (c VARCHAR(8), d VARCHAR(8));
INSERT INTO t3 VALUES ('white','black'),('cyan','yellow');
INSERT INTO t3 VALUES ('white','black'),('cyan','yellow');
ANALYZE TABLE t1, t2, t3;
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t3 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -1085,7 +1103,9 @@ INSERT INTO t2 VALUES
...
@@ -1085,7 +1103,9 @@ INSERT INTO t2 VALUES
('j'),('u'),('i'),('r'),('x'),('a'),('x'),('s');
('j'),('u'),('i'),('r'),('x'),('a'),('x'),('s');
ANALYZE TABLE t1, t2;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
SET optimizer_use_condition_selectivity=3;
SET optimizer_use_condition_selectivity=3;
...
@@ -1104,6 +1124,7 @@ insert into t1 values
...
@@ -1104,6 +1124,7 @@ insert into t1 values
set use_stat_tables='preferably';
set use_stat_tables='preferably';
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
flush table t1;
flush table t1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -1118,6 +1139,7 @@ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a`
...
@@ -1118,6 +1139,7 @@ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a`
alter table t1 change column a a int;
alter table t1 change column a a int;
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
flush table t1;
flush table t1;
explain extended select * from t1 where a between 5 and 7;
explain extended select * from t1 where a between 5 and 7;
...
@@ -1142,8 +1164,11 @@ CREATE TABLE t3 (c3 char(1), INDEX(c3)) ENGINE=MyISAM;
...
@@ -1142,8 +1164,11 @@ CREATE TABLE t3 (c3 char(1), INDEX(c3)) ENGINE=MyISAM;
INSERT INTO t3 VALUES ('v'), ('c');
INSERT INTO t3 VALUES ('v'), ('c');
ANALYZE TABLE t1,t2,t3;
ANALYZE TABLE t1,t2,t3;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t3 analyze status OK
SELECT * FROM t1
SELECT * FROM t1
WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 );
WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 );
...
@@ -1177,7 +1202,9 @@ CREATE TABLE t2 (id int, flag char(1), INDEX(id)) ENGINE=MyISAM;
...
@@ -1177,7 +1202,9 @@ CREATE TABLE t2 (id int, flag char(1), INDEX(id)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (100,'0'),(101,'1');
INSERT INTO t2 VALUES (100,'0'),(101,'1');
ANALYZE TABLE t1, t2;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM t1, t2 WHERE id = a AND ( a = 16 OR flag AND a != 6 );
SELECT * FROM t1, t2 WHERE id = a AND ( a = 16 OR flag AND a != 6 );
a id flag
a id flag
...
@@ -1200,8 +1227,11 @@ INSERT INTO continent VALUES
...
@@ -1200,8 +1227,11 @@ INSERT INTO continent VALUES
SET use_stat_tables=PREFERABLY;
SET use_stat_tables=PREFERABLY;
ANALYZE TABLE country, language, continent;
ANALYZE TABLE country, language, continent;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.country analyze status Engine-independent statistics collected
test.country analyze status OK
test.country analyze status OK
test.language analyze status Engine-independent statistics collected
test.language analyze status OK
test.language analyze status OK
test.continent analyze status Engine-independent statistics collected
test.continent analyze status OK
test.continent analyze status OK
FLUSH TABLES;
FLUSH TABLES;
SET optimizer_use_condition_selectivity=3;
SET optimizer_use_condition_selectivity=3;
...
@@ -1251,7 +1281,9 @@ create table t2 (c int, d int, key(c), key(d)) engine=myisam;
...
@@ -1251,7 +1281,9 @@ create table t2 (c int, d int, key(c), key(d)) engine=myisam;
insert t2 select floor(rand()*1e5/2)*2, floor(rand()*1e5/3)*3 from t1;
insert t2 select floor(rand()*1e5/2)*2, floor(rand()*1e5/3)*3 from t1;
analyze table t1,t2;
analyze table t1,t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=1;
explain extended
explain extended
...
...
mysql-test/r/selectivity_innodb.result
View file @
9a06e531
...
@@ -19,6 +19,7 @@ insert into t1 values
...
@@ -19,6 +19,7 @@ insert into t1 values
(9), (3), (2), (NULL), (NULL), (2), (NULL), (1), (5), (NULL);
(9), (3), (2), (NULL), (NULL), (2), (NULL), (1), (5), (NULL);
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
select * from mysql.column_stats;
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
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
...
@@ -571,6 +572,7 @@ Supplier#000000010 Saygah3gYWMp72i PY
...
@@ -571,6 +572,7 @@ Supplier#000000010 Saygah3gYWMp72i PY
set histogram_size=127;
set histogram_size=127;
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
dbt3_s001.part analyze status Engine-independent statistics collected
dbt3_s001.part analyze status OK
dbt3_s001.part analyze status OK
flush table part;
flush table part;
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=4;
...
@@ -627,6 +629,7 @@ set histogram_type='DOUBLE_PREC_HB';
...
@@ -627,6 +629,7 @@ set histogram_type='DOUBLE_PREC_HB';
set histogram_size=126;
set histogram_size=126;
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
dbt3_s001.part analyze status Engine-independent statistics collected
dbt3_s001.part analyze status OK
dbt3_s001.part analyze status OK
flush table part;
flush table part;
EXPLAIN EXTENDED select sql_calc_found_rows
EXPLAIN EXTENDED select sql_calc_found_rows
...
@@ -682,6 +685,7 @@ set histogram_type='SINGLE_PREC_HB';
...
@@ -682,6 +685,7 @@ set histogram_type='SINGLE_PREC_HB';
set histogram_size=24;
set histogram_size=24;
ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
dbt3_s001.nation analyze status Engine-independent statistics collected
dbt3_s001.nation analyze status OK
dbt3_s001.nation analyze status OK
flush table nation;
flush table nation;
EXPLAIN EXTENDED select sql_calc_found_rows
EXPLAIN EXTENDED select sql_calc_found_rows
...
@@ -830,6 +834,7 @@ set histogram_size=127;
...
@@ -830,6 +834,7 @@ set histogram_size=127;
set histogram_type='SINGLE_PREC_HB';
set histogram_type='SINGLE_PREC_HB';
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
flush table t1;
flush table t1;
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=4;
...
@@ -897,6 +902,7 @@ CREATE TABLE t1 (a int);
...
@@ -897,6 +902,7 @@ CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (9), (1);
INSERT INTO t1 VALUES (9), (1);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -924,7 +930,9 @@ CREATE TABLE t2 (c int);
...
@@ -924,7 +930,9 @@ CREATE TABLE t2 (c int);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
ANALYZE TABLE t1, t2;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -952,6 +960,7 @@ CREATE TABLE t1 (a varchar(1));
...
@@ -952,6 +960,7 @@ CREATE TABLE t1 (a varchar(1));
INSERT INTO t1 VALUES ('x'), ('y');
INSERT INTO t1 VALUES ('x'), ('y');
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -972,7 +981,9 @@ CREATE TABLE t2 (b int);
...
@@ -972,7 +981,9 @@ CREATE TABLE t2 (b int);
INSERT INTO t2 VALUES (4),(5),(2),(5),(1),(1),(2);
INSERT INTO t2 VALUES (4),(5),(2),(5),(1),(1),(2);
ANALYZE TABLE t1, t2;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -998,6 +1009,7 @@ INSERT INTO t1 VALUES
...
@@ -998,6 +1009,7 @@ INSERT INTO t1 VALUES
(1),(7),(4),(7),(NULL),(2),(NULL),(4),(NULL),(NULL),(1),(3),(8),(8);
(1),(7),(4),(7),(NULL),(2),(NULL),(4),(NULL),(NULL),(1),(3),(8),(8);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
FLUSH TABLE t1;
FLUSH TABLE t1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -1045,8 +1057,11 @@ INSERT INTO t3 VALUES
...
@@ -1045,8 +1057,11 @@ INSERT INTO t3 VALUES
('brown'),('taylor'),('anderson'),('taylor');
('brown'),('taylor'),('anderson'),('taylor');
ANALYZE TABLE t1, t2, t3;
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t3 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=4;
...
@@ -1070,8 +1085,11 @@ CREATE TABLE t3 (c VARCHAR(8), d VARCHAR(8));
...
@@ -1070,8 +1085,11 @@ CREATE TABLE t3 (c VARCHAR(8), d VARCHAR(8));
INSERT INTO t3 VALUES ('white','black'),('cyan','yellow');
INSERT INTO t3 VALUES ('white','black'),('cyan','yellow');
ANALYZE TABLE t1, t2, t3;
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t3 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -1095,7 +1113,9 @@ INSERT INTO t2 VALUES
...
@@ -1095,7 +1113,9 @@ INSERT INTO t2 VALUES
('j'),('u'),('i'),('r'),('x'),('a'),('x'),('s');
('j'),('u'),('i'),('r'),('x'),('a'),('x'),('s');
ANALYZE TABLE t1, t2;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
FLUSH TABLES;
FLUSH TABLES;
SET optimizer_use_condition_selectivity=3;
SET optimizer_use_condition_selectivity=3;
...
@@ -1114,6 +1134,7 @@ insert into t1 values
...
@@ -1114,6 +1134,7 @@ insert into t1 values
set use_stat_tables='preferably';
set use_stat_tables='preferably';
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
flush table t1;
flush table t1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=3;
...
@@ -1128,6 +1149,7 @@ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a`
...
@@ -1128,6 +1149,7 @@ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a`
alter table t1 change column a a int;
alter table t1 change column a a int;
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
flush table t1;
flush table t1;
explain extended select * from t1 where a between 5 and 7;
explain extended select * from t1 where a between 5 and 7;
...
@@ -1152,8 +1174,11 @@ CREATE TABLE t3 (c3 char(1), INDEX(c3)) ENGINE=MyISAM;
...
@@ -1152,8 +1174,11 @@ CREATE TABLE t3 (c3 char(1), INDEX(c3)) ENGINE=MyISAM;
INSERT INTO t3 VALUES ('v'), ('c');
INSERT INTO t3 VALUES ('v'), ('c');
ANALYZE TABLE t1,t2,t3;
ANALYZE TABLE t1,t2,t3;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t3 analyze status OK
SELECT * FROM t1
SELECT * FROM t1
WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 );
WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 );
...
@@ -1187,7 +1212,9 @@ CREATE TABLE t2 (id int, flag char(1), INDEX(id)) ENGINE=MyISAM;
...
@@ -1187,7 +1212,9 @@ CREATE TABLE t2 (id int, flag char(1), INDEX(id)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (100,'0'),(101,'1');
INSERT INTO t2 VALUES (100,'0'),(101,'1');
ANALYZE TABLE t1, t2;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM t1, t2 WHERE id = a AND ( a = 16 OR flag AND a != 6 );
SELECT * FROM t1, t2 WHERE id = a AND ( a = 16 OR flag AND a != 6 );
a id flag
a id flag
...
@@ -1210,8 +1237,11 @@ INSERT INTO continent VALUES
...
@@ -1210,8 +1237,11 @@ INSERT INTO continent VALUES
SET use_stat_tables=PREFERABLY;
SET use_stat_tables=PREFERABLY;
ANALYZE TABLE country, language, continent;
ANALYZE TABLE country, language, continent;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.country analyze status Engine-independent statistics collected
test.country analyze status OK
test.country analyze status OK
test.language analyze status Engine-independent statistics collected
test.language analyze status OK
test.language analyze status OK
test.continent analyze status Engine-independent statistics collected
test.continent analyze status OK
test.continent analyze status OK
FLUSH TABLES;
FLUSH TABLES;
SET optimizer_use_condition_selectivity=3;
SET optimizer_use_condition_selectivity=3;
...
@@ -1261,7 +1291,9 @@ create table t2 (c int, d int, key(c), key(d)) engine=myisam;
...
@@ -1261,7 +1291,9 @@ create table t2 (c int, d int, key(c), key(d)) engine=myisam;
insert t2 select floor(rand()*1e5/2)*2, floor(rand()*1e5/3)*3 from t1;
insert t2 select floor(rand()*1e5/2)*2, floor(rand()*1e5/3)*3 from t1;
analyze table t1,t2;
analyze table t1,t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=1;
explain extended
explain extended
...
...
mysql-test/r/selectivity_no_engine.result
View file @
9a06e531
...
@@ -31,6 +31,7 @@ set histogram_size=100;
...
@@ -31,6 +31,7 @@ set histogram_size=100;
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=4;
analyze table t2 persistent for all;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
# The following two must have the same in 'Extra' column:
# The following two must have the same in 'Extra' column:
explain extended select * from t2 where col1 IN (20, 180);
explain extended select * from t2 where col1 IN (20, 180);
...
@@ -55,6 +56,7 @@ set histogram_size=20;
...
@@ -55,6 +56,7 @@ set histogram_size=20;
set histogram_type='single_prec_hb';
set histogram_type='single_prec_hb';
analyze table t1 persistent for all;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
set use_stat_tables='preferably';
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=4;
...
@@ -96,6 +98,7 @@ min(col1) max(col1) count(*)
...
@@ -96,6 +98,7 @@ min(col1) max(col1) count(*)
set histogram_size=100;
set histogram_size=100;
analyze table t1 persistent for all;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
explain extended select * from t1 where col1 in (1,2,3);
explain extended select * from t1 where col1 in (1,2,3);
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
...
...
mysql-test/r/stat_tables.result
View file @
9a06e531
...
@@ -350,6 +350,7 @@ create table t1 (i int);
...
@@ -350,6 +350,7 @@ create table t1 (i int);
lock table t1 write;
lock table t1 write;
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
alter table t1 add column a varchar(8);
alter table t1 add column a varchar(8);
drop table t1;
drop table t1;
...
@@ -362,6 +363,7 @@ INSERT INTO t1 VALUES (1),(2);
...
@@ -362,6 +363,7 @@ INSERT INTO t1 VALUES (1),(2);
DELETE FROM t1 WHERE a=1;
DELETE FROM t1 WHERE a=1;
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
DROP TABLE t1;
DROP TABLE t1;
#
#
...
@@ -390,10 +392,12 @@ CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM;
...
@@ -390,10 +392,12 @@ CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
INSERT INTO t1 VALUES (1),(2);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
CREATE TABLE t2 (name char(3)) ENGINE=MyISAM;
CREATE TABLE t2 (name char(3)) ENGINE=MyISAM;
ANALYZE TABLE t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
INSERT INTO t2 VALUES ('USA'),('AUS');
INSERT INTO t2 VALUES ('USA'),('AUS');
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
...
@@ -406,6 +410,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -406,6 +410,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where
ANALYZE TABLE t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
id name
id name
...
...
mysql-test/r/stat_tables_innodb.result
View file @
9a06e531
...
@@ -377,6 +377,7 @@ create table t1 (i int);
...
@@ -377,6 +377,7 @@ create table t1 (i int);
lock table t1 write;
lock table t1 write;
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
alter table t1 add column a varchar(8);
alter table t1 add column a varchar(8);
drop table t1;
drop table t1;
...
@@ -389,6 +390,7 @@ INSERT INTO t1 VALUES (1),(2);
...
@@ -389,6 +390,7 @@ INSERT INTO t1 VALUES (1),(2);
DELETE FROM t1 WHERE a=1;
DELETE FROM t1 WHERE a=1;
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
DROP TABLE t1;
DROP TABLE t1;
#
#
...
@@ -417,10 +419,12 @@ CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM;
...
@@ -417,10 +419,12 @@ CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
INSERT INTO t1 VALUES (1),(2);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
CREATE TABLE t2 (name char(3)) ENGINE=MyISAM;
CREATE TABLE t2 (name char(3)) ENGINE=MyISAM;
ANALYZE TABLE t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
INSERT INTO t2 VALUES ('USA'),('AUS');
INSERT INTO t2 VALUES ('USA'),('AUS');
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
...
@@ -433,6 +437,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -433,6 +437,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where
ANALYZE TABLE t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
id name
id name
...
...
mysql-test/r/stat_tables_par.result
View file @
9a06e531
...
@@ -226,6 +226,7 @@ create table t1 (a int, b int, key(a));
...
@@ -226,6 +226,7 @@ create table t1 (a int, b int, key(a));
insert t1 values (1,1),(2,2);
insert t1 values (1,1),(2,2);
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
select * from information_schema.statistics where table_schema='test';
select * from information_schema.statistics where table_schema='test';
...
...
mysql-test/r/stat_tables_par_innodb.result
View file @
9a06e531
...
@@ -259,6 +259,7 @@ create table t1 (a int, b int, key(a));
...
@@ -259,6 +259,7 @@ create table t1 (a int, b int, key(a));
insert t1 values (1,1),(2,2);
insert t1 values (1,1),(2,2);
analyze table t1;
analyze table t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
select * from information_schema.statistics where table_schema='test';
select * from information_schema.statistics where table_schema='test';
...
...
mysql-test/r/stat_tables_partition.result
View file @
9a06e531
...
@@ -7,6 +7,7 @@ CREATE TABLE t1 (pk int PRIMARY KEY, a bit(1), INDEX idx(a)
...
@@ -7,6 +7,7 @@ CREATE TABLE t1 (pk int PRIMARY KEY, a bit(1), INDEX idx(a)
INSERT INTO t1 VALUES (1,1),(2,0),(3,0),(4,1);
INSERT INTO t1 VALUES (1,1),(2,0),(3,0),(4,1);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SET use_stat_tables = DEFAULT;
SET use_stat_tables = DEFAULT;
DROP TABLE t1;
DROP TABLE t1;
mysql-test/r/stat_tables_rbr.result
View file @
9a06e531
...
@@ -5,6 +5,7 @@ SET GLOBAL use_stat_tables = PREFERABLY;
...
@@ -5,6 +5,7 @@ SET GLOBAL use_stat_tables = PREFERABLY;
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
DROP TABLE t1;
DROP TABLE t1;
SET GLOBAL use_stat_tables = DEFAULT;
SET GLOBAL use_stat_tables = DEFAULT;
...
@@ -12,6 +13,7 @@ SET use_stat_tables = PREFERABLY;
...
@@ -12,6 +13,7 @@ SET use_stat_tables = PREFERABLY;
CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2;
CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2;
ALTER TABLE t1 ANALYZE PARTITION p1;
ALTER TABLE t1 ANALYZE PARTITION p1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SHOW BINLOG EVENTS;
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
Log_name Pos Event_type Server_id End_log_pos Info
...
...
mysql-test/r/stat_tables_repl.result
View file @
9a06e531
...
@@ -8,12 +8,14 @@ CREATE TABLE t1 ( a int, b int ) ENGINE=MyISAM;
...
@@ -8,12 +8,14 @@ CREATE TABLE t1 ( a int, b int ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
DROP INDEX idx1 ON t1;
DROP INDEX idx1 ON t1;
DROP TABLE t1;
DROP TABLE t1;
...
@@ -21,6 +23,7 @@ CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
...
@@ -21,6 +23,7 @@ CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
ALTER TABLE t1 DROP COLUMN b;
ALTER TABLE t1 DROP COLUMN b;
DROP TABLE t1;
DROP TABLE t1;
...
@@ -28,6 +31,7 @@ CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
...
@@ -28,6 +31,7 @@ CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
ALTER TABLE t1 RENAME to s;
ALTER TABLE t1 RENAME to s;
DROP TABLE s;
DROP TABLE s;
...
@@ -35,6 +39,7 @@ CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
...
@@ -35,6 +39,7 @@ CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
ALTER TABLE t1 CHANGE COLUMN b c int ;
ALTER TABLE t1 CHANGE COLUMN b c int ;
DROP TABLE t1;
DROP TABLE t1;
...
...
mysql-test/r/statistics.result
View file @
9a06e531
...
@@ -59,6 +59,7 @@ INSERT INTO t1 VALUES
...
@@ -59,6 +59,7 @@ INSERT INTO t1 VALUES
(25, 'zzzzzzzzzzzzzzzzzz', 'bbb', '1989-03-12', 0.01, b'101');
(25, 'zzzzzzzzzzzzzzzzzz', 'bbb', '1989-03-12', 0.01, b'101');
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SELECT * FROM mysql.table_stats;
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
db_name table_name cardinality
...
@@ -210,6 +211,7 @@ DELETE FROM mysql.column_stats;
...
@@ -210,6 +211,7 @@ DELETE FROM mysql.column_stats;
set histogram_size=4;
set histogram_size=4;
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
SELECT db_name, table_name, column_name,
SELECT db_name, table_name, column_name,
min_value, max_value,
min_value, max_value,
...
@@ -228,6 +230,7 @@ set histogram_size=8;
...
@@ -228,6 +230,7 @@ set histogram_size=8;
set histogram_type='DOUBLE_PREC_HB';
set histogram_type='DOUBLE_PREC_HB';
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
SELECT db_name, table_name, column_name,
SELECT db_name, table_name, column_name,
min_value, max_value,
min_value, max_value,
...
@@ -246,6 +249,7 @@ set histogram_size= 0;
...
@@ -246,6 +249,7 @@ set histogram_size= 0;
set histogram_type=default;
set histogram_type=default;
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
CREATE TABLE t3 (
CREATE TABLE t3 (
a int NOT NULL PRIMARY KEY,
a int NOT NULL PRIMARY KEY,
...
@@ -273,6 +277,7 @@ INSERT INTO t3 VALUES
...
@@ -273,6 +277,7 @@ INSERT INTO t3 VALUES
(29, 'vvvvvvvvvvvvv', 'dddddddd');
(29, 'vvvvvvvvvvvvv', 'dddddddd');
ANALYZE TABLE t3;
ANALYZE TABLE t3;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t3 analyze status OK
SELECT * FROM mysql.table_stats;
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
db_name table_name cardinality
...
@@ -574,6 +579,7 @@ test t1 idx2 2 2.3846
...
@@ -574,6 +579,7 @@ test t1 idx2 2 2.3846
test t1 idx3 1 8.5000
test t1 idx3 1 8.5000
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx4);
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx4);
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SELECT * FROM mysql.column_stats;
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
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
...
@@ -774,6 +780,7 @@ test t1 PRIMARY 1 1.0000
...
@@ -774,6 +780,7 @@ test t1 PRIMARY 1 1.0000
test t1 idx3 1 8.5000
test t1 idx3 1 8.5000
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SELECT * FROM mysql.column_stats;
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
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
...
@@ -797,6 +804,7 @@ test t1 idx4 3 NULL
...
@@ -797,6 +804,7 @@ test t1 idx4 3 NULL
UPDATE t1 SET b=(SELECT b FROM t0 WHERE t0.a= t1.a);
UPDATE t1 SET b=(SELECT b FROM t0 WHERE t0.a= t1.a);
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SELECT * FROM mysql.column_stats;
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
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
...
@@ -873,6 +881,7 @@ test t1 PRIMARY 1 1.0000
...
@@ -873,6 +881,7 @@ test t1 PRIMARY 1 1.0000
test t1 idx3 1 8.5000
test t1 idx3 1 8.5000
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SELECT * FROM mysql.column_stats;
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
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
...
@@ -898,6 +907,7 @@ DELETE FROM mysql.column_stats;
...
@@ -898,6 +907,7 @@ DELETE FROM mysql.column_stats;
DELETE FROM mysql.index_stats;
DELETE FROM mysql.index_stats;
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES();
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES();
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.table_stats;
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
db_name table_name cardinality
...
@@ -908,6 +918,7 @@ SELECT * FROM mysql.index_stats;
...
@@ -908,6 +918,7 @@ SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
db_name table_name index_name prefix_arity avg_frequency
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(c,e,b) INDEXES(idx2,idx4);
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(c,e,b) INDEXES(idx2,idx4);
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.table_stats;
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
db_name table_name cardinality
...
@@ -934,6 +945,7 @@ test t1 idx4 2 1.6875
...
@@ -934,6 +945,7 @@ test t1 idx4 2 1.6875
test t1 idx4 3 1.1304
test t1 idx4 3 1.1304
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES(primary);
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES(primary);
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.index_stats;
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
db_name table_name index_name prefix_arity avg_frequency
...
@@ -948,6 +960,7 @@ DELETE FROM mysql.column_stats;
...
@@ -948,6 +960,7 @@ DELETE FROM mysql.column_stats;
DELETE FROM mysql.index_stats;
DELETE FROM mysql.index_stats;
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.table_stats;
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
db_name table_name cardinality
...
@@ -977,6 +990,7 @@ INSERT INTO t2 SELECT * FROM t1;
...
@@ -977,6 +990,7 @@ INSERT INTO t2 SELECT * FROM t1;
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=off';
ANALYZE TABLE t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM mysql.table_stats;
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
db_name table_name cardinality
...
@@ -1022,6 +1036,7 @@ DELETE FROM mysql.index_stats;
...
@@ -1022,6 +1036,7 @@ DELETE FROM mysql.index_stats;
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=on';
ANALYZE TABLE t2;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM mysql.table_stats;
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
db_name table_name cardinality
...
@@ -1070,6 +1085,7 @@ test t2 idx4 2 1.6875
...
@@ -1070,6 +1085,7 @@ test t2 idx4 2 1.6875
test t2 idx4 3 1.1304
test t2 idx4 3 1.1304
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
db_name table_name index_name prefix_arity avg_frequency
...
@@ -1094,6 +1110,7 @@ test t2 idx2 2 2.3846
...
@@ -1094,6 +1110,7 @@ test t2 idx2 2 2.3846
test t2 idx3 1 8.5000
test t2 idx3 1 8.5000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
db_name table_name index_name prefix_arity avg_frequency
...
@@ -1128,6 +1145,7 @@ test t2 idx4 3 1.1154
...
@@ -1128,6 +1145,7 @@ test t2 idx4 3 1.1154
test t2 idx4 4 1.0000
test t2 idx4 4 1.0000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
db_name table_name index_name prefix_arity avg_frequency
...
@@ -1152,6 +1170,7 @@ test t2 idx2 2 2.3846
...
@@ -1152,6 +1170,7 @@ test t2 idx2 2 2.3846
test t2 idx3 1 8.5000
test t2 idx3 1 8.5000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
db_name table_name index_name prefix_arity avg_frequency
...
@@ -1192,6 +1211,7 @@ test t2 idx3 2 1.0000
...
@@ -1192,6 +1211,7 @@ test t2 idx3 2 1.0000
test t2 PRIMARY 1 1.0000
test t2 PRIMARY 1 1.0000
ANALYZE TABLE t1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
SELECT * FROM mysql.column_stats;
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
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
...
@@ -1244,6 +1264,7 @@ db_name table_name index_name prefix_arity avg_frequency
...
@@ -1244,6 +1264,7 @@ db_name table_name index_name prefix_arity avg_frequency
set use_stat_tables='never';
set use_stat_tables='never';
ANALYZE TABLE t1 PERSISTENT FOR ALL;
ANALYZE TABLE t1 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.table_stats;
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
db_name table_name cardinality
...
@@ -1523,6 +1544,7 @@ insert into t1 values (1),(2),(3);
...
@@ -1523,6 +1544,7 @@ insert into t1 values (1),(2),(3);
set histogram_size=10;
set histogram_size=10;
analyze table t1 persistent for all;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
select db_name, table_name, column_name,
select db_name, table_name, column_name,
min_value, max_value,
min_value, max_value,
...
@@ -1547,6 +1569,7 @@ histogram_size 10
...
@@ -1547,6 +1569,7 @@ histogram_size 10
histogram_type DOUBLE_PREC_HB
histogram_type DOUBLE_PREC_HB
analyze table t1 persistent for all;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t1 analyze status OK
select db_name, table_name, column_name,
select db_name, table_name, column_name,
min_value, max_value,
min_value, max_value,
...
@@ -1587,6 +1610,7 @@ set @@max_heap_table_size=1024*16;
...
@@ -1587,6 +1610,7 @@ set @@max_heap_table_size=1024*16;
set histogram_size=63;
set histogram_size=63;
analyze table t2 persistent for all;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t2 analyze status OK
select db_name, table_name, column_name,
select db_name, table_name, column_name,
min_value, max_value,
min_value, max_value,
...
...
sql/sql_admin.cc
View file @
9a06e531
...
@@ -736,6 +736,17 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
...
@@ -736,6 +736,17 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
compl_result_code
=
update_statistics_for_table
(
thd
,
table
->
table
);
compl_result_code
=
update_statistics_for_table
(
thd
,
table
->
table
);
if
(
compl_result_code
)
if
(
compl_result_code
)
result_code
=
HA_ADMIN_FAILED
;
result_code
=
HA_ADMIN_FAILED
;
else
{
protocol
->
prepare_for_resend
();
protocol
->
store
(
table_name
,
system_charset_info
);
protocol
->
store
(
operator_name
,
system_charset_info
);
protocol
->
store
(
STRING_WITH_LEN
(
"status"
),
system_charset_info
);
protocol
->
store
(
STRING_WITH_LEN
(
"Engine-independent statistics collected"
),
system_charset_info
);
if
(
protocol
->
write
())
goto
err
;
}
}
}
if
(
result_code
==
HA_ADMIN_NOT_IMPLEMENTED
&&
need_repair_or_alter
)
if
(
result_code
==
HA_ADMIN_NOT_IMPLEMENTED
&&
need_repair_or_alter
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment