Skip to content

Commit 825f51d

Browse files
committed
MDEV-9118 ANALYZE TABLE for Engine independent status fetchs blob/text columns without use
Do not include BLOB fields by default.
1 parent 45920d3 commit 825f51d

File tree

11 files changed

+123
-18
lines changed

11 files changed

+123
-18
lines changed

mysql-test/r/analyze.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_g
3434
insert into t1 values ('hello');
3535
analyze table t1;
3636
Table Op Msg_type Msg_text
37+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
3738
test.t1 analyze status OK
3839
analyze table t1;
3940
Table Op Msg_type Msg_text
41+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
4042
test.t1 analyze status Table is already up to date
4143
drop table t1;
4244
CREATE TABLE t1 (a int);

mysql-test/r/mysqlcheck.result

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,34 @@ mtr.test_suppressions OK
77
mysql.column_stats OK
88
mysql.columns_priv OK
99
mysql.db OK
10-
mysql.event OK
10+
mysql.event
11+
Warning : Engine-independent statistics are not collected for column 'body'
12+
Warning : Engine-independent statistics are not collected for column 'body_utf8'
13+
status : OK
1114
mysql.func OK
1215
mysql.gtid_slave_pos OK
13-
mysql.help_category OK
16+
mysql.help_category
17+
Warning : Engine-independent statistics are not collected for column 'url'
18+
status : OK
1419
mysql.help_keyword OK
1520
mysql.help_relation OK
16-
mysql.help_topic OK
21+
mysql.help_topic
22+
Warning : Engine-independent statistics are not collected for column 'description'
23+
Warning : Engine-independent statistics are not collected for column 'example'
24+
Warning : Engine-independent statistics are not collected for column 'url'
25+
status : OK
1726
mysql.host OK
1827
mysql.index_stats OK
1928
mysql.innodb_index_stats OK
2029
mysql.innodb_table_stats OK
2130
mysql.plugin OK
22-
mysql.proc OK
31+
mysql.proc
32+
Warning : Engine-independent statistics are not collected for column 'param_list'
33+
Warning : Engine-independent statistics are not collected for column 'returns'
34+
Warning : Engine-independent statistics are not collected for column 'body'
35+
Warning : Engine-independent statistics are not collected for column 'comment'
36+
Warning : Engine-independent statistics are not collected for column 'body_utf8'
37+
status : OK
2338
mysql.procs_priv OK
2439
mysql.proxies_priv OK
2540
mysql.roles_mapping OK
@@ -31,7 +46,12 @@ mysql.time_zone_leap_second OK
3146
mysql.time_zone_name OK
3247
mysql.time_zone_transition OK
3348
mysql.time_zone_transition_type OK
34-
mysql.user OK
49+
mysql.user
50+
Warning : Engine-independent statistics are not collected for column 'ssl_cipher'
51+
Warning : Engine-independent statistics are not collected for column 'x509_issuer'
52+
Warning : Engine-independent statistics are not collected for column 'x509_subject'
53+
Warning : Engine-independent statistics are not collected for column 'authentication_string'
54+
status : OK
3555
mtr.global_suppressions Table is already up to date
3656
mtr.test_suppressions Table is already up to date
3757
mysql.column_stats OK
@@ -69,19 +89,34 @@ mysql.user OK
6989
mysql.column_stats OK
7090
mysql.columns_priv OK
7191
mysql.db OK
72-
mysql.event OK
92+
mysql.event
93+
Warning : Engine-independent statistics are not collected for column 'body'
94+
Warning : Engine-independent statistics are not collected for column 'body_utf8'
95+
status : OK
7396
mysql.func OK
7497
mysql.gtid_slave_pos OK
75-
mysql.help_category OK
98+
mysql.help_category
99+
Warning : Engine-independent statistics are not collected for column 'url'
100+
status : OK
76101
mysql.help_keyword OK
77102
mysql.help_relation OK
78-
mysql.help_topic OK
103+
mysql.help_topic
104+
Warning : Engine-independent statistics are not collected for column 'description'
105+
Warning : Engine-independent statistics are not collected for column 'example'
106+
Warning : Engine-independent statistics are not collected for column 'url'
107+
status : OK
79108
mysql.host OK
80109
mysql.index_stats OK
81110
mysql.innodb_index_stats OK
82111
mysql.innodb_table_stats OK
83112
mysql.plugin OK
84-
mysql.proc OK
113+
mysql.proc
114+
Warning : Engine-independent statistics are not collected for column 'param_list'
115+
Warning : Engine-independent statistics are not collected for column 'returns'
116+
Warning : Engine-independent statistics are not collected for column 'body'
117+
Warning : Engine-independent statistics are not collected for column 'comment'
118+
Warning : Engine-independent statistics are not collected for column 'body_utf8'
119+
status : OK
85120
mysql.procs_priv OK
86121
mysql.proxies_priv OK
87122
mysql.roles_mapping OK
@@ -93,7 +128,12 @@ mysql.time_zone_leap_second OK
93128
mysql.time_zone_name OK
94129
mysql.time_zone_transition OK
95130
mysql.time_zone_transition_type OK
96-
mysql.user OK
131+
mysql.user
132+
Warning : Engine-independent statistics are not collected for column 'ssl_cipher'
133+
Warning : Engine-independent statistics are not collected for column 'x509_issuer'
134+
Warning : Engine-independent statistics are not collected for column 'x509_subject'
135+
Warning : Engine-independent statistics are not collected for column 'authentication_string'
136+
status : OK
97137
mysql.column_stats Table is already up to date
98138
mysql.columns_priv Table is already up to date
99139
mysql.db Table is already up to date

mysql-test/r/statistics.result

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,7 @@ test t2 PRIMARY 1 1.0000
12121212
ANALYZE TABLE t1;
12131213
Table Op Msg_type Msg_text
12141214
test.t1 analyze status Engine-independent statistics collected
1215+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'b'
12151216
test.t1 analyze status OK
12161217
SELECT * FROM mysql.column_stats;
12171218
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
@@ -1225,7 +1226,6 @@ test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
12251226
test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL
12261227
test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
12271228
test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
1228-
test t1 b NULL NULL 0.2000 17.1250 NULL NULL NULL NULL
12291229
SELECT * FROM mysql.index_stats;
12301230
db_name table_name index_name prefix_arity avg_frequency
12311231
test t1 idx2 1 7.0000
@@ -1265,6 +1265,7 @@ set use_stat_tables='never';
12651265
ANALYZE TABLE t1 PERSISTENT FOR ALL;
12661266
Table Op Msg_type Msg_text
12671267
test.t1 analyze status Engine-independent statistics collected
1268+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'b'
12681269
test.t1 analyze status Table is already up to date
12691270
SELECT * FROM mysql.table_stats;
12701271
db_name table_name cardinality
@@ -1276,7 +1277,6 @@ test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
12761277
test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL
12771278
test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
12781279
test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
1279-
test t1 b NULL NULL 0.2000 17.1250 NULL NULL NULL NULL
12801280
SELECT * FROM mysql.index_stats;
12811281
db_name table_name index_name prefix_arity avg_frequency
12821282
test t1 PRIMARY 1 1.0000
@@ -1291,6 +1291,28 @@ test t1 idx4 3 NULL
12911291
DELETE FROM mysql.table_stats;
12921292
DELETE FROM mysql.column_stats;
12931293
DELETE FROM mysql.index_stats;
1294+
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES();
1295+
Table Op Msg_type Msg_text
1296+
test.t1 analyze status Engine-independent statistics collected
1297+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'b'
1298+
test.t1 analyze status Table is already up to date
1299+
ANALYZE TABLE t1 PERSISTENT FOR columns(a,b) INDEXES();
1300+
Table Op Msg_type Msg_text
1301+
test.t1 analyze status Engine-independent statistics collected
1302+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'b'
1303+
test.t1 analyze status Table is already up to date
1304+
ANALYZE TABLE t1 PERSISTENT FOR columns(b) indexes(idx2);
1305+
Table Op Msg_type Msg_text
1306+
test.t1 analyze status Engine-independent statistics collected
1307+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'b'
1308+
test.t1 analyze status Table is already up to date
1309+
ANALYZE TABLE t1 PERSISTENT FOR columns() indexes(idx2);
1310+
Table Op Msg_type Msg_text
1311+
test.t1 analyze status Engine-independent statistics collected
1312+
test.t1 analyze status Table is already up to date
1313+
DELETE FROM mysql.table_stats;
1314+
DELETE FROM mysql.column_stats;
1315+
DELETE FROM mysql.index_stats;
12941316
DROP TABLE t1,t2;
12951317
set names utf8;
12961318
CREATE DATABASE world;

mysql-test/r/statistics_index_crash-7362.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977
33
ANALYZE TABLE t1 PERSISTENT FOR ALL;
44
Table Op Msg_type Msg_text
55
test.t1 analyze status Engine-independent statistics collected
6+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
67
test.t1 analyze status OK
78
SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1';
89
db_name table_name index_name prefix_arity avg_frequency
@@ -13,6 +14,7 @@ INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977
1314
ANALYZE TABLE t1 PERSISTENT FOR ALL;
1415
Table Op Msg_type Msg_text
1516
test.t1 analyze status Engine-independent statistics collected
17+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
1618
test.t1 analyze status OK
1719
SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1';
1820
db_name table_name index_name prefix_arity avg_frequency

mysql-test/suite/innodb_fts/r/innodb-fts-fic.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ count
3636
2
3737
ANALYZE TABLE articles;
3838
Table Op Msg_type Msg_text
39+
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
3940
test.articles analyze status OK
4041
SELECT * FROM articles WHERE MATCH (title,body)
4142
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);

mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ articles CREATE TABLE `articles` (
247247
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
248248
ANALYZE TABLE articles;
249249
Table Op Msg_type Msg_text
250+
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
250251
test.articles analyze status OK
251252
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
252253
id title body
@@ -569,6 +570,7 @@ select @@innodb_ft_enable_stopword;
569570
1
570571
ANALYZE TABLE articles;
571572
Table Op Msg_type Msg_text
573+
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
572574
test.articles analyze status OK
573575
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
574576
id title body

mysql-test/suite/innodb_zip/r/innodb-zip.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ a left(b,40)
122122
1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
123123
analyze table t1;
124124
Table Op Msg_type Msg_text
125+
mysqltest_innodb_zip.t1 analyze Warning Engine-independent statistics are not collected for column 'b'
125126
mysqltest_innodb_zip.t1 analyze status OK
126127
analyze table t2;
127128
Table Op Msg_type Msg_text
129+
mysqltest_innodb_zip.t2 analyze Warning Engine-independent statistics are not collected for column 'b'
128130
mysqltest_innodb_zip.t2 analyze status OK
129131
SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
130132
table_schema table_name row_format data_length index_length

mysql-test/suite/parts/r/partition_repair_myisam.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ FLUSH TABLES;
322322
# replacing p6 with a crashed MYD file (1) (splitted dynamic record)
323323
ANALYZE TABLE t1_will_crash;
324324
Table Op Msg_type Msg_text
325+
test.t1_will_crash analyze Warning Engine-independent statistics are not collected for column 'c'
325326
test.t1_will_crash analyze status OK
326327
OPTIMIZE TABLE t1_will_crash;
327328
Table Op Msg_type Msg_text

mysql-test/t/statistics.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,17 @@ DELETE FROM mysql.table_stats;
494494
DELETE FROM mysql.column_stats;
495495
DELETE FROM mysql.index_stats;
496496

497+
498+
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES();
499+
ANALYZE TABLE t1 PERSISTENT FOR columns(a,b) INDEXES();
500+
ANALYZE TABLE t1 PERSISTENT FOR columns(b) indexes(idx2);
501+
ANALYZE TABLE t1 PERSISTENT FOR columns() indexes(idx2);
502+
503+
DELETE FROM mysql.table_stats;
504+
DELETE FROM mysql.column_stats;
505+
DELETE FROM mysql.index_stats;
506+
507+
497508
DROP TABLE t1,t2;
498509

499510
set names utf8;

sql/share/errmsg-utf8.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7136,3 +7136,6 @@ ER_KILL_QUERY_DENIED_ERROR
71367136
eng "You are not owner of query %lu"
71377137
ger "Sie sind nicht Eigentümer von Abfrage %lu"
71387138
rus "Вы не являетесь владельцем запроса %lu"
7139+
ER_NO_EIS_FOR_FIELD
7140+
eng "Engine-independent statistics are not collected for column '%s'"
7141+
ukr "Незалежна від типу таблиці статистика не збирається для стовбця '%s'"

0 commit comments

Comments
 (0)