diff options
author | Igor Babaev <igor@askmonty.org> | 2013-04-05 23:48:49 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-04-05 23:48:49 -0700 |
commit | 1ae352afbe40a71f26cec2da0f08eefdef05f41f (patch) | |
tree | e3bd1f7a38f6911c1c95d9271908771a4ab0fe11 /mysql-test | |
parent | 503731d80f732a3a790443cc530fea2c3721b869 (diff) | |
download | mariadb-git-1ae352afbe40a71f26cec2da0f08eefdef05f41f.tar.gz |
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.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/selectivity.result | 6 | ||||
-rw-r--r-- | mysql-test/r/selectivity_innodb.result | 6 | ||||
-rw-r--r-- | mysql-test/r/statistics.result | 76 | ||||
-rw-r--r-- | mysql-test/t/selectivity.test | 2 | ||||
-rw-r--r-- | mysql-test/t/statistics.test | 53 |
5 files changed, 117 insertions, 26 deletions
diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 5de454ba58c..f05b26cc724 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -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: diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 6d0c8434051..57037574e5d 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -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: diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index 2289bda7889..9291b945193 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -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; diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index 5bce7f50e0d..095c853d7de 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -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(); diff --git a/mysql-test/t/statistics.test b/mysql-test/t/statistics.test index 2488e511bab..4d11e11f033 100644 --- a/mysql-test/t/statistics.test +++ b/mysql-test/t/statistics.test @@ -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; -
\ No newline at end of file |