Fixed bugs mdev-4357 and mdev-4359.
The values of the column HIST_TYPE from the statistical table mysql.column_stats were stored in the table and read from the table incorrectly.
This commit is contained in:
parent
503731d80f
commit
1ae352afbe
@ -536,7 +536,7 @@ limit 10;
|
||||
s_name s_address
|
||||
Supplier#000000010 Saygah3gYWMp72i PY
|
||||
set histogram_type='DOUBLE_PREC_HB';
|
||||
set histogram_size=254;
|
||||
set histogram_size=126;
|
||||
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
|
||||
Table Op Msg_type Msg_text
|
||||
dbt3_s001.part analyze status Table is already up to date
|
||||
@ -562,7 +562,7 @@ limit 10;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY nation ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort
|
||||
1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00
|
||||
1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 7.03 Using where
|
||||
1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 7.81 Using where
|
||||
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where; FirstMatch(supplier)
|
||||
4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where
|
||||
Warnings:
|
||||
@ -616,7 +616,7 @@ limit 10;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY nation ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort
|
||||
1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00
|
||||
1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 7.03 Using where
|
||||
1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 7.81 Using where
|
||||
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where; FirstMatch(supplier)
|
||||
4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where
|
||||
Warnings:
|
||||
|
@ -540,7 +540,7 @@ limit 10;
|
||||
s_name s_address
|
||||
Supplier#000000010 Saygah3gYWMp72i PY
|
||||
set histogram_type='DOUBLE_PREC_HB';
|
||||
set histogram_size=254;
|
||||
set histogram_size=126;
|
||||
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
|
||||
Table Op Msg_type Msg_text
|
||||
dbt3_s001.part analyze status OK
|
||||
@ -567,7 +567,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY nation ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort
|
||||
1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
|
||||
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 7.03 Using where
|
||||
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 7.81 Using where
|
||||
2 MATERIALIZED partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where
|
||||
4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.37 Using where
|
||||
Warnings:
|
||||
@ -622,7 +622,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY nation ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort
|
||||
1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
|
||||
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 7.03 Using where
|
||||
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 7.81 Using where
|
||||
2 MATERIALIZED partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where
|
||||
4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.37 Using where
|
||||
Warnings:
|
||||
|
@ -214,15 +214,15 @@ test.t1 analyze status Table is already up to date
|
||||
SELECT db_name, table_name, column_name,
|
||||
min_value, max_value,
|
||||
nulls_ratio, avg_frequency,
|
||||
hist_size, HEX(histogram)
|
||||
hist_size, hist_type, HEX(histogram)
|
||||
FROM mysql.column_stats;
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_frequency hist_size HEX(histogram)
|
||||
test t1 a 0 49 0.0000 1.0000 4 2E62A1D0
|
||||
test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 6.4000 4 003FBFFF
|
||||
test t1 c aaaa dddddddd 0.1250 7.0000 4 0055AAFF
|
||||
test t1 d 1989-03-12 1999-07-23 0.1500 8.5000 4 009393FF
|
||||
test t1 e 0.01 0.112 0.2250 6.2000 4 000564E1
|
||||
test t1 f 1 5 0.2000 6.4000 4 3F7FBFBF
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_frequency hist_size hist_type HEX(histogram)
|
||||
test t1 a 0 49 0.0000 1.0000 4 SINGLE_PREC_HB 2E62A1D0
|
||||
test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 6.4000 4 SINGLE_PREC_HB 003FBFFF
|
||||
test t1 c aaaa dddddddd 0.1250 7.0000 4 SINGLE_PREC_HB 0055AAFF
|
||||
test t1 d 1989-03-12 1999-07-23 0.1500 8.5000 4 SINGLE_PREC_HB 009393FF
|
||||
test t1 e 0.01 0.112 0.2250 6.2000 4 SINGLE_PREC_HB 000564E1
|
||||
test t1 f 1 5 0.2000 6.4000 4 SINGLE_PREC_HB 3F7FBFBF
|
||||
DELETE FROM mysql.column_stats;
|
||||
set histogram_size=8;
|
||||
set histogram_type='DOUBLE_PREC_HB';
|
||||
@ -232,15 +232,15 @@ test.t1 analyze status Table is already up to date
|
||||
SELECT db_name, table_name, column_name,
|
||||
min_value, max_value,
|
||||
nulls_ratio, avg_frequency,
|
||||
hist_size, HEX(histogram)
|
||||
hist_size, hist_type, HEX(histogram)
|
||||
FROM mysql.column_stats;
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_frequency hist_size HEX(histogram)
|
||||
test t1 a 0 49 0.0000 1.0000 8 052F4363F4A1F9D0
|
||||
test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 6.4000 8 0000FF3FFFBFFFFF
|
||||
test t1 c aaaa dddddddd 0.1250 7.0000 8 00005555AAAAFFFF
|
||||
test t1 d 1989-03-12 1999-07-23 0.1500 8.5000 8 000026942694FFFF
|
||||
test t1 e 0.01 0.112 0.2250 6.2000 8 000005056464E1E1
|
||||
test t1 f 1 5 0.2000 6.4000 8 FF3FFF7FFFBFFFBF
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_frequency hist_size hist_type HEX(histogram)
|
||||
test t1 a 0 49 0.0000 1.0000 8 DOUBLE_PREC_HB 052F4363F4A1F9D0
|
||||
test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 6.4000 8 DOUBLE_PREC_HB 0000FF3FFFBFFFFF
|
||||
test t1 c aaaa dddddddd 0.1250 7.0000 8 DOUBLE_PREC_HB 00005555AAAAFFFF
|
||||
test t1 d 1989-03-12 1999-07-23 0.1500 8.5000 8 DOUBLE_PREC_HB 000026942694FFFF
|
||||
test t1 e 0.01 0.112 0.2250 6.2000 8 DOUBLE_PREC_HB 000005056464E1E1
|
||||
test t1 f 1 5 0.2000 6.4000 8 DOUBLE_PREC_HB FF3FFF7FFFBFFFBF
|
||||
DELETE FROM mysql.column_stats;
|
||||
set histogram_size= 0;
|
||||
set histogram_type=default;
|
||||
@ -1467,4 +1467,48 @@ UPPER(db_name) UPPER(table_name) index_name prefix_arity avg_frequency
|
||||
DELETE FROM mysql.table_stats;
|
||||
DELETE FROM mysql.column_stats;
|
||||
DELETE FROM mysql.index_stats;
|
||||
#
|
||||
# Bug mdev-4357: empty string as a value of the HIST_SIZE column
|
||||
# from mysql.column_stats
|
||||
#
|
||||
create table t1 (a int);
|
||||
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 OK
|
||||
select db_name, table_name, column_name,
|
||||
min_value, max_value,
|
||||
nulls_ratio, avg_frequency,
|
||||
hist_size, hist_type, HEX(histogram)
|
||||
FROM mysql.column_stats;
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_frequency hist_size hist_type HEX(histogram)
|
||||
test t1 a 1 3 0.0000 1.0000 10 SINGLE_PREC_HB 0000007F7F7F7FFFFFFF
|
||||
set histogram_size=default;
|
||||
drop table t1;
|
||||
#
|
||||
# Bug mdev-4359: wrong setting of the HIST_SIZE column
|
||||
# (see also mdev-4357) from mysql.column_stats
|
||||
#
|
||||
create table t1 ( a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
set histogram_size=10;
|
||||
set histogram_type='double_prec_hb';
|
||||
show variables like 'histogram%';
|
||||
Variable_name Value
|
||||
histogram_size 10
|
||||
histogram_type DOUBLE_PREC_HB
|
||||
analyze table t1 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
select db_name, table_name, column_name,
|
||||
min_value, max_value,
|
||||
nulls_ratio, avg_frequency,
|
||||
hist_size, hist_type, HEX(histogram)
|
||||
FROM mysql.column_stats;
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_frequency hist_size hist_type HEX(histogram)
|
||||
test t1 a 1 5 0.0000 1.0000 10 DOUBLE_PREC_HB 0000FF3FFF7FFFBFFFFF
|
||||
set histogram_size=default;
|
||||
set histogram_type=default;
|
||||
drop table t1;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
|
@ -211,7 +211,7 @@ eval EXPLAIN EXTENDED $Q20;
|
||||
eval $Q20;
|
||||
|
||||
set histogram_type='DOUBLE_PREC_HB';
|
||||
set histogram_size=254;
|
||||
set histogram_size=126;
|
||||
|
||||
ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
|
||||
|
||||
|
@ -174,7 +174,7 @@ ANALYZE TABLE t1;
|
||||
SELECT db_name, table_name, column_name,
|
||||
min_value, max_value,
|
||||
nulls_ratio, avg_frequency,
|
||||
hist_size, HEX(histogram)
|
||||
hist_size, hist_type, HEX(histogram)
|
||||
FROM mysql.column_stats;
|
||||
|
||||
DELETE FROM mysql.column_stats;
|
||||
@ -186,7 +186,7 @@ ANALYZE TABLE t1;
|
||||
SELECT db_name, table_name, column_name,
|
||||
min_value, max_value,
|
||||
nulls_ratio, avg_frequency,
|
||||
hist_size, HEX(histogram)
|
||||
hist_size, hist_type, HEX(histogram)
|
||||
FROM mysql.column_stats;
|
||||
|
||||
DELETE FROM mysql.column_stats;
|
||||
@ -590,6 +590,53 @@ DELETE FROM mysql.table_stats;
|
||||
DELETE FROM mysql.column_stats;
|
||||
DELETE FROM mysql.index_stats;
|
||||
|
||||
--echo #
|
||||
--echo # Bug mdev-4357: empty string as a value of the HIST_SIZE column
|
||||
--echo # from mysql.column_stats
|
||||
--echo #
|
||||
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
|
||||
set histogram_size=10;
|
||||
|
||||
analyze table t1 persistent for all;
|
||||
|
||||
select db_name, table_name, column_name,
|
||||
min_value, max_value,
|
||||
nulls_ratio, avg_frequency,
|
||||
hist_size, hist_type, HEX(histogram)
|
||||
FROM mysql.column_stats;
|
||||
|
||||
set histogram_size=default;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug mdev-4359: wrong setting of the HIST_SIZE column
|
||||
--echo # (see also mdev-4357) from mysql.column_stats
|
||||
--echo #
|
||||
|
||||
create table t1 ( a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
|
||||
set histogram_size=10;
|
||||
set histogram_type='double_prec_hb';
|
||||
|
||||
show variables like 'histogram%';
|
||||
|
||||
analyze table t1 persistent for all;
|
||||
|
||||
select db_name, table_name, column_name,
|
||||
min_value, max_value,
|
||||
nulls_ratio, avg_frequency,
|
||||
hist_size, hist_type, HEX(histogram)
|
||||
FROM mysql.column_stats;
|
||||
|
||||
set histogram_size=default;
|
||||
set histogram_type=default;
|
||||
|
||||
drop table t1;
|
||||
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
|
||||
|
@ -929,7 +929,8 @@ public:
|
||||
stat_field->store(table_field->collected_stats->histogram.get_size());
|
||||
break;
|
||||
case COLUMN_STAT_HIST_TYPE:
|
||||
stat_field->store(table_field->collected_stats->histogram.get_type());
|
||||
stat_field->store(table_field->collected_stats->histogram.get_type() +
|
||||
1);
|
||||
break;
|
||||
case COLUMN_STAT_HISTOGRAM:
|
||||
const char * col_histogram=
|
||||
@ -1011,7 +1012,8 @@ public:
|
||||
table_field->read_stats->histogram.set_size(stat_field->val_int());
|
||||
break;
|
||||
case COLUMN_STAT_HIST_TYPE:
|
||||
Histogram_type hist_type= (Histogram_type) (stat_field->val_int());
|
||||
Histogram_type hist_type= (Histogram_type) (stat_field->val_int() -
|
||||
1);
|
||||
table_field->read_stats->histogram.set_type(hist_type);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user