Commit 92e49bb0 authored by Sergey Petrunya's avatar Sergey Petrunya

MDEV-4360: ANALYZE shows "Table is already up to date" while updating stats

- Show a line with "Engine-independent statistics collected" when ANALYZE command
  caused EITS statistics to be recollected.
parent 42263a2b
......@@ -16,6 +16,7 @@ insert into t1 values
(9), (3), (2), (NULL), (NULL), (2), (NULL), (1), (5), (NULL);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
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
......@@ -567,6 +568,7 @@ Supplier#000000010 Saygah3gYWMp72i PY
set histogram_size=127;
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
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
flush table part;
set optimizer_use_condition_selectivity=4;
......@@ -622,6 +624,7 @@ set histogram_type='DOUBLE_PREC_HB';
set histogram_size=126;
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
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
flush table part;
EXPLAIN EXTENDED select sql_calc_found_rows
......@@ -676,6 +679,7 @@ set histogram_type='SINGLE_PREC_HB';
set histogram_size=24;
ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
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
flush table nation;
EXPLAIN EXTENDED select sql_calc_found_rows
......@@ -821,6 +825,7 @@ set histogram_size=127;
set histogram_type='SINGLE_PREC_HB';
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
flush table t1;
set optimizer_use_condition_selectivity=4;
......@@ -888,6 +893,7 @@ CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (9), (1);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -915,7 +921,9 @@ CREATE TABLE t2 (c int);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
ANALYZE TABLE t1, t2;
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.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -942,6 +950,7 @@ CREATE TABLE t1 (a varchar(1));
INSERT INTO t1 VALUES ('x'), ('y');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -962,7 +971,9 @@ CREATE TABLE t2 (b int);
INSERT INTO t2 VALUES (4),(5),(2),(5),(1),(1),(2);
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -988,6 +999,7 @@ INSERT INTO t1 VALUES
(1),(7),(4),(7),(NULL),(2),(NULL),(4),(NULL),(NULL),(1),(3),(8),(8);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
FLUSH TABLE t1;
set optimizer_use_condition_selectivity=3;
......@@ -1035,8 +1047,11 @@ INSERT INTO t3 VALUES
('brown'),('taylor'),('anderson'),('taylor');
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=4;
......@@ -1060,8 +1075,11 @@ CREATE TABLE t3 (c VARCHAR(8), d VARCHAR(8));
INSERT INTO t3 VALUES ('white','black'),('cyan','yellow');
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -1085,7 +1103,9 @@ INSERT INTO t2 VALUES
('j'),('u'),('i'),('r'),('x'),('a'),('x'),('s');
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
FLUSH TABLES;
SET optimizer_use_condition_selectivity=3;
......@@ -1104,6 +1124,7 @@ insert into t1 values
set use_stat_tables='preferably';
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
flush table t1;
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`
alter table t1 change column a a int;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
flush table t1;
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;
INSERT INTO t3 VALUES ('v'), ('c');
ANALYZE TABLE t1,t2,t3;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SELECT * FROM t1
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;
INSERT INTO t2 VALUES (100,'0'),(101,'1');
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM t1, t2 WHERE id = a AND ( a = 16 OR flag AND a != 6 );
a id flag
......@@ -1200,8 +1227,11 @@ INSERT INTO continent VALUES
SET use_stat_tables=PREFERABLY;
ANALYZE TABLE country, language, continent;
Table Op Msg_type Msg_text
test.country analyze status Engine-independent statistics collected
test.country analyze status OK
test.language analyze status Engine-independent statistics collected
test.language analyze status OK
test.continent analyze status Engine-independent statistics collected
test.continent analyze status OK
FLUSH TABLES;
SET optimizer_use_condition_selectivity=3;
......@@ -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;
analyze table t1,t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
set optimizer_use_condition_selectivity=1;
explain extended
......
......@@ -19,6 +19,7 @@ insert into t1 values
(9), (3), (2), (NULL), (NULL), (2), (NULL), (1), (5), (NULL);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
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
......@@ -571,6 +572,7 @@ Supplier#000000010 Saygah3gYWMp72i PY
set histogram_size=127;
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
Table Op Msg_type Msg_text
dbt3_s001.part analyze status Engine-independent statistics collected
dbt3_s001.part analyze status OK
flush table part;
set optimizer_use_condition_selectivity=4;
......@@ -627,6 +629,7 @@ set histogram_type='DOUBLE_PREC_HB';
set histogram_size=126;
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
Table Op Msg_type Msg_text
dbt3_s001.part analyze status Engine-independent statistics collected
dbt3_s001.part analyze status OK
flush table part;
EXPLAIN EXTENDED select sql_calc_found_rows
......@@ -682,6 +685,7 @@ set histogram_type='SINGLE_PREC_HB';
set histogram_size=24;
ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
Table Op Msg_type Msg_text
dbt3_s001.nation analyze status Engine-independent statistics collected
dbt3_s001.nation analyze status OK
flush table nation;
EXPLAIN EXTENDED select sql_calc_found_rows
......@@ -830,6 +834,7 @@ set histogram_size=127;
set histogram_type='SINGLE_PREC_HB';
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
flush table t1;
set optimizer_use_condition_selectivity=4;
......@@ -897,6 +902,7 @@ CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (9), (1);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -924,7 +930,9 @@ CREATE TABLE t2 (c int);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -952,6 +960,7 @@ CREATE TABLE t1 (a varchar(1));
INSERT INTO t1 VALUES ('x'), ('y');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -972,7 +981,9 @@ CREATE TABLE t2 (b int);
INSERT INTO t2 VALUES (4),(5),(2),(5),(1),(1),(2);
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -998,6 +1009,7 @@ INSERT INTO t1 VALUES
(1),(7),(4),(7),(NULL),(2),(NULL),(4),(NULL),(NULL),(1),(3),(8),(8);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
FLUSH TABLE t1;
set optimizer_use_condition_selectivity=3;
......@@ -1045,8 +1057,11 @@ INSERT INTO t3 VALUES
('brown'),('taylor'),('anderson'),('taylor');
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=4;
......@@ -1070,8 +1085,11 @@ CREATE TABLE t3 (c VARCHAR(8), d VARCHAR(8));
INSERT INTO t3 VALUES ('white','black'),('cyan','yellow');
ANALYZE TABLE t1, t2, t3;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
......@@ -1095,7 +1113,9 @@ INSERT INTO t2 VALUES
('j'),('u'),('i'),('r'),('x'),('a'),('x'),('s');
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
FLUSH TABLES;
SET optimizer_use_condition_selectivity=3;
......@@ -1114,6 +1134,7 @@ insert into t1 values
set use_stat_tables='preferably';
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
flush table t1;
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`
alter table t1 change column a a int;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
flush table t1;
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;
INSERT INTO t3 VALUES ('v'), ('c');
ANALYZE TABLE t1,t2,t3;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SELECT * FROM t1
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;
INSERT INTO t2 VALUES (100,'0'),(101,'1');
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM t1, t2 WHERE id = a AND ( a = 16 OR flag AND a != 6 );
a id flag
......@@ -1210,8 +1237,11 @@ INSERT INTO continent VALUES
SET use_stat_tables=PREFERABLY;
ANALYZE TABLE country, language, continent;
Table Op Msg_type Msg_text
test.country analyze status Engine-independent statistics collected
test.country analyze status OK
test.language analyze status Engine-independent statistics collected
test.language analyze status OK
test.continent analyze status Engine-independent statistics collected
test.continent analyze status OK
FLUSH TABLES;
SET optimizer_use_condition_selectivity=3;
......@@ -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;
analyze table t1,t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
set optimizer_use_condition_selectivity=1;
explain extended
......
......@@ -31,6 +31,7 @@ set histogram_size=100;
set optimizer_use_condition_selectivity=4;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
# The following two must have the same in 'Extra' column:
explain extended select * from t2 where col1 IN (20, 180);
......@@ -55,6 +56,7 @@ set histogram_size=20;
set histogram_type='single_prec_hb';
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
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
......@@ -96,6 +98,7 @@ min(col1) max(col1) count(*)
set histogram_size=100;
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
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
......
......@@ -350,6 +350,7 @@ create table t1 (i int);
lock table t1 write;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
alter table t1 add column a varchar(8);
drop table t1;
......@@ -362,6 +363,7 @@ INSERT INTO t1 VALUES (1),(2);
DELETE FROM t1 WHERE a=1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
#
......@@ -390,10 +392,12 @@ CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CREATE TABLE t2 (name char(3)) ENGINE=MyISAM;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
INSERT INTO t2 VALUES ('USA'),('AUS');
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
1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
id name
......
......@@ -377,6 +377,7 @@ create table t1 (i int);
lock table t1 write;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
alter table t1 add column a varchar(8);
drop table t1;
......@@ -389,6 +390,7 @@ INSERT INTO t1 VALUES (1),(2);
DELETE FROM t1 WHERE a=1;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
#
......@@ -417,10 +419,12 @@ CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
CREATE TABLE t2 (name char(3)) ENGINE=MyISAM;
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
INSERT INTO t2 VALUES ('USA'),('AUS');
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
1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
id name
......
......@@ -226,6 +226,7 @@ create table t1 (a int, b int, key(a));
insert t1 values (1,1),(2,2);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
select * from information_schema.statistics where table_schema='test';
......
......@@ -259,6 +259,7 @@ create table t1 (a int, b int, key(a));
insert t1 values (1,1),(2,2);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
select * from information_schema.statistics where table_schema='test';
......
......@@ -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);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET use_stat_tables = DEFAULT;
DROP TABLE t1;
......@@ -5,6 +5,7 @@ SET GLOBAL use_stat_tables = PREFERABLY;
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
SET GLOBAL use_stat_tables = DEFAULT;
......@@ -12,6 +13,7 @@ SET use_stat_tables = PREFERABLY;
CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2;
ALTER TABLE t1 ANALYZE PARTITION p1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
......
......@@ -8,12 +8,14 @@ CREATE TABLE t1 ( a int, b int ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP INDEX idx1 ON t1;
DROP TABLE t1;
......@@ -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);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 DROP COLUMN b;
DROP TABLE t1;
......@@ -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);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 RENAME to s;
DROP TABLE s;
......@@ -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);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 CHANGE COLUMN b c int ;
DROP TABLE t1;
......
......@@ -59,6 +59,7 @@ INSERT INTO t1 VALUES
(25, 'zzzzzzzzzzzzzzzzzz', 'bbb', '1989-03-12', 0.01, b'101');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
......@@ -210,6 +211,7 @@ DELETE FROM mysql.column_stats;
set histogram_size=4;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
SELECT db_name, table_name, column_name,
min_value, max_value,
......@@ -228,6 +230,7 @@ set histogram_size=8;
set histogram_type='DOUBLE_PREC_HB';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
SELECT db_name, table_name, column_name,
min_value, max_value,
......@@ -246,6 +249,7 @@ set histogram_size= 0;
set histogram_type=default;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
CREATE TABLE t3 (
a int NOT NULL PRIMARY KEY,
......@@ -273,6 +277,7 @@ INSERT INTO t3 VALUES
(29, 'vvvvvvvvvvvvv', 'dddddddd');
ANALYZE TABLE t3;
Table Op Msg_type Msg_text
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
......@@ -574,6 +579,7 @@ test t1 idx2 2 2.3846
test t1 idx3 1 8.5000
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx4);
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
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
......@@ -774,6 +780,7 @@ test t1 PRIMARY 1 1.0000
test t1 idx3 1 8.5000
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
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
......@@ -797,6 +804,7 @@ test t1 idx4 3 NULL
UPDATE t1 SET b=(SELECT b FROM t0 WHERE t0.a= t1.a);
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
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
......@@ -873,6 +881,7 @@ test t1 PRIMARY 1 1.0000
test t1 idx3 1 8.5000
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
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
......@@ -898,6 +907,7 @@ DELETE FROM mysql.column_stats;
DELETE FROM mysql.index_stats;
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES();
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
......@@ -908,6 +918,7 @@ SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(c,e,b) INDEXES(idx2,idx4);
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
......@@ -934,6 +945,7 @@ test t1 idx4 2 1.6875
test t1 idx4 3 1.1304
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES(primary);
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
......@@ -948,6 +960,7 @@ DELETE FROM mysql.column_stats;
DELETE FROM mysql.index_stats;
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS ALL INDEXES 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
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
......@@ -977,6 +990,7 @@ INSERT INTO t2 SELECT * FROM t1;
set optimizer_switch='extended_keys=off';
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
......@@ -1022,6 +1036,7 @@ DELETE FROM mysql.index_stats;
set optimizer_switch='extended_keys=on';
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
......@@ -1070,6 +1085,7 @@ test t2 idx4 2 1.6875
test t2 idx4 3 1.1304
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
......@@ -1094,6 +1110,7 @@ test t2 idx2 2 2.3846
test t2 idx3 1 8.5000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
......@@ -1128,6 +1145,7 @@ test t2 idx4 3 1.1154
test t2 idx4 4 1.0000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
......@@ -1152,6 +1170,7 @@ test t2 idx2 2 2.3846
test t2 idx3 1 8.5000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
......@@ -1192,6 +1211,7 @@ test t2 idx3 2 1.0000
test t2 PRIMARY 1 1.0000
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
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
......@@ -1244,6 +1264,7 @@ db_name table_name index_name prefix_arity avg_frequency
set use_stat_tables='never';
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
SELECT * FROM mysql.table_stats;
db_name table_name cardinality
......@@ -1523,6 +1544,7 @@ insert into t1 values (1),(2),(3);
set histogram_size=10;
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
select db_name, table_name, column_name,
min_value, max_value,
......@@ -1547,6 +1569,7 @@ histogram_size 10
histogram_type DOUBLE_PREC_HB
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
select db_name, table_name, column_name,
min_value, max_value,
......@@ -1587,6 +1610,7 @@ set @@max_heap_table_size=1024*16;
set histogram_size=63;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select db_name, table_name, column_name,
min_value, max_value,
......
......@@ -736,6 +736,17 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
compl_result_code= update_statistics_for_table(thd, table->table);
if (compl_result_code)
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment