diff options
author | Igor Babaev <igor@askmonty.org> | 2013-03-30 22:00:04 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-03-30 22:00:04 -0700 |
commit | 78bab7839502e02d6d62b50d99ac9b0637acb4a1 (patch) | |
tree | dd345c47c4d9a55e1061697151b9e6d38b2a5e07 /mysql-test | |
parent | 905549863454647b6070e23b7cf5fc1394f92750 (diff) | |
parent | 9e1ca1053b5e619e1f6c727abdf787dc163ab4e6 (diff) | |
download | mariadb-git-78bab7839502e02d6d62b50d99ac9b0637acb4a1.tar.gz |
Merge
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/mysqld--help.result | 6 | ||||
-rw-r--r-- | mysql-test/r/selectivity.result | 65 | ||||
-rw-r--r-- | mysql-test/r/selectivity_innodb.result | 66 | ||||
-rw-r--r-- | mysql-test/r/statistics.result | 465 | ||||
-rw-r--r-- | mysql-test/r/system_mysql_db.result | 1 | ||||
-rw-r--r-- | mysql-test/suite/funcs_1/r/is_columns_mysql.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/histogram_type_basic.result | 79 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/histogram_type_basic.test | 92 | ||||
-rw-r--r-- | mysql-test/t/selectivity.test | 22 | ||||
-rw-r--r-- | mysql-test/t/statistics.test | 14 |
10 files changed, 583 insertions, 231 deletions
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 1804bd1c6fb..13747404733 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -204,6 +204,11 @@ The following options may be given as the first argument: -?, --help Display this help and exit. --histogram-size=# Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. + --histogram-type=name + Specifies type of the histograms created by ANALYZE. + Possible values are: SINGLE_PREC_HB - single precision + height-balanced, DOUBLE_PREC_HB - double precision + height-balanced. --ignore-builtin-innodb Disable initialization of builtin InnoDB plugin --ignore-db-dirs=name @@ -932,6 +937,7 @@ general-log FALSE group-concat-max-len 1024 help TRUE histogram-size 0 +histogram-type SINGLE_PREC_HB ignore-builtin-innodb FALSE ignore-db-dirs init-connect diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 77a26bc21f1..3b56046ae19 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -11,6 +11,7 @@ CREATE DATABASE dbt3_s001; use dbt3_s001; set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; set @save_histogram_size=@@histogram_size; +set @save_histogram_type=@@histogram_type; === Q15 === create view revenue0 (supplier_no, total_revenue) as select l_suppkey, sum(l_extendedprice * (1 - l_discount)) @@ -401,6 +402,10 @@ order by s_name limit 10; s_name s_address Supplier#000000010 Saygah3gYWMp72i PY +SELECT ((SELECT COUNT(*) FROM part WHERE p_name LIKE 'g%') / +(SELECT COUNT(*) FROM part)) AS sel; +sel +0.0600 set optimizer_use_condition_selectivity=3; EXPLAIN EXTENDED select sql_calc_found_rows s_name, s_address @@ -452,10 +457,10 @@ limit 10; s_name s_address Supplier#000000010 Saygah3gYWMp72i PY set histogram_size=15; -flush table part; 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 +flush table part; set optimizer_use_condition_selectivity=4; EXPLAIN EXTENDED select sql_calc_found_rows s_name, s_address @@ -505,11 +510,66 @@ order by s_name limit 10; s_name s_address Supplier#000000010 Saygah3gYWMp72i PY +set histogram_type='DOUBLE_PREC_HB'; +set histogram_size=30; +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 +flush table part; +EXPLAIN EXTENDED select sql_calc_found_rows +s_name, s_address +from supplier, nation +where s_suppkey in (select ps_suppkey from partsupp +where ps_partkey in (select p_partkey from part +where p_name like 'g%') +and ps_availqty > +(select 0.5 * sum(l_quantity) +from lineitem +where l_partkey = ps_partkey +and l_suppkey = ps_suppkey +and l_shipdate >= date('1993-01-01') +and l_shipdate < date('1993-01-01') + +interval '1' year )) +and s_nationkey = n_nationkey +and n_name = 'UNITED STATES' +order by s_name +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 6.25 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: +Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 +Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +select sql_calc_found_rows +s_name, s_address +from supplier, nation +where s_suppkey in (select ps_suppkey from partsupp +where ps_partkey in (select p_partkey from part +where p_name like 'g%') +and ps_availqty > +(select 0.5 * sum(l_quantity) +from lineitem +where l_partkey = ps_partkey +and l_suppkey = ps_suppkey +and l_shipdate >= date('1993-01-01') +and l_shipdate < date('1993-01-01') + +interval '1' year )) +and s_nationkey = n_nationkey +and n_name = 'UNITED STATES' +order by s_name +limit 10; +s_name s_address +Supplier#000000010 Saygah3gYWMp72i PY +set histogram_type='SINGLE_PREC_HB'; set histogram_size=24; -flush table nation; ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES(); Table Op Msg_type Msg_text dbt3_s001.nation analyze status Table is already up to date +flush table nation; EXPLAIN EXTENDED select sql_calc_found_rows s_name, s_address from supplier, nation @@ -559,6 +619,7 @@ limit 10; s_name s_address Supplier#000000010 Saygah3gYWMp72i PY DROP DATABASE dbt3_s001; +set histogram_type=@save_histogram_type; set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 6fbff38000d..2b5efd356c8 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -14,6 +14,7 @@ CREATE DATABASE dbt3_s001; use dbt3_s001; set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; set @save_histogram_size=@@histogram_size; +set @save_histogram_type=@@histogram_type; === Q15 === create view revenue0 (supplier_no, total_revenue) as select l_suppkey, sum(l_extendedprice * (1 - l_discount)) @@ -404,6 +405,10 @@ order by s_name limit 10; s_name s_address Supplier#000000010 Saygah3gYWMp72i PY +SELECT ((SELECT COUNT(*) FROM part WHERE p_name LIKE 'g%') / +(SELECT COUNT(*) FROM part)) AS sel; +sel +0.0600 set optimizer_use_condition_selectivity=3; EXPLAIN EXTENDED select sql_calc_found_rows s_name, s_address @@ -455,10 +460,10 @@ limit 10; s_name s_address Supplier#000000010 Saygah3gYWMp72i PY set histogram_size=15; -flush table part; ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES(); Table Op Msg_type Msg_text dbt3_s001.part analyze status OK +flush table part; set optimizer_use_condition_selectivity=4; EXPLAIN EXTENDED select sql_calc_found_rows s_name, s_address @@ -509,11 +514,67 @@ order by s_name limit 10; s_name s_address Supplier#000000010 Saygah3gYWMp72i PY +set histogram_type='DOUBLE_PREC_HB'; +set histogram_size=30; +ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES(); +Table Op Msg_type Msg_text +dbt3_s001.part analyze status OK +flush table part; +EXPLAIN EXTENDED select sql_calc_found_rows +s_name, s_address +from supplier, nation +where s_suppkey in (select ps_suppkey from partsupp +where ps_partkey in (select p_partkey from part +where p_name like 'g%') +and ps_availqty > +(select 0.5 * sum(l_quantity) +from lineitem +where l_partkey = ps_partkey +and l_suppkey = ps_suppkey +and l_shipdate >= date('1993-01-01') +and l_shipdate < date('1993-01-01') + +interval '1' year )) +and s_nationkey = n_nationkey +and n_name = 'UNITED STATES' +order by s_name +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 <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 6.25 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: +Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 +Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 +Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10 +select sql_calc_found_rows +s_name, s_address +from supplier, nation +where s_suppkey in (select ps_suppkey from partsupp +where ps_partkey in (select p_partkey from part +where p_name like 'g%') +and ps_availqty > +(select 0.5 * sum(l_quantity) +from lineitem +where l_partkey = ps_partkey +and l_suppkey = ps_suppkey +and l_shipdate >= date('1993-01-01') +and l_shipdate < date('1993-01-01') + +interval '1' year )) +and s_nationkey = n_nationkey +and n_name = 'UNITED STATES' +order by s_name +limit 10; +s_name s_address +Supplier#000000010 Saygah3gYWMp72i PY +set histogram_type='SINGLE_PREC_HB'; set histogram_size=24; -flush table nation; ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES(); Table Op Msg_type Msg_text dbt3_s001.nation analyze status OK +flush table nation; EXPLAIN EXTENDED select sql_calc_found_rows s_name, s_address from supplier, nation @@ -564,6 +625,7 @@ limit 10; s_name s_address Supplier#000000010 Saygah3gYWMp72i PY DROP DATABASE dbt3_s001; +set histogram_type=@save_histogram_type; set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index 2abff4416c9..2289bda7889 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -64,13 +64,13 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -87,8 +87,8 @@ COUNT(*) 40 SELECT * FROM mysql.column_stats WHERE db_name='test' AND table_name='t1' AND column_name='a'; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL SELECT MIN(t1.a), MAX(t1.a), (SELECT COUNT(*) FROM t1 WHERE t1.b IS NULL) / (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.a)", @@ -99,8 +99,8 @@ MIN(t1.a) MAX(t1.a) NULLS_RATIO(t1.a) AVG_FREQUENCY(t1.a) 0 49 0.2000 1.0000 SELECT * FROM mysql.column_stats WHERE db_name='test' AND table_name='t1' AND column_name='b'; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL SELECT MIN(t1.b), MAX(t1.b), (SELECT COUNT(*) FROM t1 WHERE t1.b IS NULL) / (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.b)", @@ -111,8 +111,8 @@ MIN(t1.b) MAX(t1.b) NULLS_RATIO(t1.b) AVG_FREQUENCY(t1.b) vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 6.4000 SELECT * FROM mysql.column_stats WHERE db_name='test' AND table_name='t1' AND column_name='c'; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL SELECT MIN(t1.c), MAX(t1.c), (SELECT COUNT(*) FROM t1 WHERE t1.c IS NULL) / (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.c)", @@ -123,8 +123,8 @@ MIN(t1.c) MAX(t1.c) NULLS_RATIO(t1.c) AVG_FREQUENCY(t1.c) aaaa dddddddd 0.1250 7.0000 SELECT * FROM mysql.column_stats WHERE db_name='test' AND table_name='t1' AND column_name='d'; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL SELECT MIN(t1.d), MAX(t1.d), (SELECT COUNT(*) FROM t1 WHERE t1.d IS NULL) / (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.d)", @@ -135,8 +135,8 @@ MIN(t1.d) MAX(t1.d) NULLS_RATIO(t1.d) AVG_FREQUENCY(t1.d) 1989-03-12 1999-07-23 0.1500 8.5000 SELECT * FROM mysql.column_stats WHERE db_name='test' AND table_name='t1' AND column_name='e'; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL SELECT MIN(t1.e), MAX(t1.e), (SELECT COUNT(*) FROM t1 WHERE t1.e IS NULL) / (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.e)", @@ -224,7 +224,26 @@ 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 DELETE FROM mysql.column_stats; +set histogram_size=8; +set histogram_type='DOUBLE_PREC_HB'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +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) +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 +DELETE FROM mysql.column_stats; set histogram_size= 0; +set histogram_type=default; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status Table is already up to date @@ -260,16 +279,16 @@ db_name table_name cardinality test t1 40 test t3 17 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL -test t3 a 0 38 0.0000 4.0000 1.0000 0 NULL -test t3 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.1765 18.0714 2.8000 0 NULL -test t3 c aaaa dddddddd 0.1176 6.4000 3.7500 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL +test t3 a 0 38 0.0000 4.0000 1.0000 0 NULL NULL +test t3 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.1765 18.0714 2.8000 0 NULL NULL +test t3 c aaaa dddddddd 0.1176 6.4000 3.7500 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -289,16 +308,16 @@ db_name table_name cardinality test s1 40 test t3 17 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test s1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test s1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test s1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test s1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test s1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test s1 f 1 5 0.2000 1.0000 6.4000 0 NULL -test t3 a 0 38 0.0000 4.0000 1.0000 0 NULL -test t3 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.1765 18.0714 2.8000 0 NULL -test t3 c aaaa dddddddd 0.1176 6.4000 3.7500 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test s1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test s1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test s1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test s1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test s1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test s1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL +test t3 a 0 38 0.0000 4.0000 1.0000 0 NULL NULL +test t3 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.1765 18.0714 2.8000 0 NULL NULL +test t3 c aaaa dddddddd 0.1176 6.4000 3.7500 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test s1 PRIMARY 1 1.0000 @@ -318,16 +337,16 @@ db_name table_name cardinality test t1 40 test t3 17 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL -test t3 a 0 38 0.0000 4.0000 1.0000 0 NULL -test t3 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.1765 18.0714 2.8000 0 NULL -test t3 c aaaa dddddddd 0.1176 6.4000 3.7500 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL +test t3 a 0 38 0.0000 4.0000 1.0000 0 NULL NULL +test t3 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.1765 18.0714 2.8000 0 NULL NULL +test t3 c aaaa dddddddd 0.1176 6.4000 3.7500 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -346,13 +365,13 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -387,13 +406,13 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`y`,`x`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 x vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 y 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 x vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 y 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL ALTER TABLE t1 CHANGE COLUMN x b varchar(32), CHANGE COLUMN y e double; SHOW CREATE TABLE t1; @@ -412,13 +431,13 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`e`,`b`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL ALTER TABLE t1 RENAME TO s1, CHANGE COLUMN b x varchar(32); SHOW CREATE TABLE s1; Table Create Table @@ -439,13 +458,13 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test s1 40 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test s1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test s1 x vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test s1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test s1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test s1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test s1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test s1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test s1 x vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test s1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test s1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test s1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test s1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test s1 PRIMARY 1 1.0000 @@ -477,13 +496,13 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -512,12 +531,12 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`e`,`x`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -541,12 +560,12 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`e`,`b`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -557,13 +576,13 @@ ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx4); Table Op Msg_type Msg_text 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 histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -598,12 +617,12 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`e`,`x`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -627,12 +646,12 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`e`,`b`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -646,13 +665,13 @@ LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/save_index_stats' INTO TABLE mysql.index_stats FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'; SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -680,12 +699,12 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`e`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -743,12 +762,12 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`e`,`b`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -757,13 +776,13 @@ ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4); Table Op Msg_type Msg_text 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 histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b NULL NULL 1.0000 NULL NULL 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b NULL NULL 1.0000 NULL NULL 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -780,13 +799,13 @@ ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4); Table Op Msg_type Msg_text 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 histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -812,12 +831,12 @@ t1 CREATE TABLE `t1` ( KEY `idx3` (`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -842,12 +861,12 @@ t1 CREATE TABLE `t1` ( KEY `idx4` (`e`,`b`,`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -856,13 +875,13 @@ ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4); Table Op Msg_type Msg_text 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 histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -884,7 +903,7 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram 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); @@ -894,10 +913,10 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 idx2 1 7.0000 @@ -934,13 +953,13 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -964,19 +983,19 @@ db_name table_name cardinality test t1 40 test t2 40 SELECT * FROM mysql.column_stats ORDER BY column_name; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t2 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL -test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t2 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL +test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -1008,13 +1027,13 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test t2 40 SELECT * FROM mysql.column_stats ORDER BY column_name; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t2 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL -test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t2 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL +test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; db_name table_name index_name prefix_arity avg_frequency test t2 PRIMARY 1 1.0000 @@ -1144,12 +1163,12 @@ MODIFY COLUMN b text, ADD INDEX idx1 (b(4), e), ADD INDEX idx4 (e, b(4), d); SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t2 idx3 1 8.5000 @@ -1165,18 +1184,18 @@ ANALYZE TABLE t1; Table Op Msg_type Msg_text 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 histogram -test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL -test t1 b NULL NULL 0.2000 17.1250 NULL NULL NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL +test t1 b NULL NULL 0.2000 17.1250 NULL NULL NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t2 idx3 1 8.5000 @@ -1209,7 +1228,7 @@ mysql.column_stats analyze status OK SELECT * FROM mysql.table_stats; db_name table_name cardinality SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency set use_stat_tables='never'; @@ -1220,13 +1239,13 @@ SELECT * FROM mysql.table_stats; db_name table_name cardinality test t1 40 SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size histogram -test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL -test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL -test t1 b NULL NULL 0.2000 17.1250 NULL NULL NULL +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL +test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL +test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL +test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL +test t1 b NULL NULL 0.2000 17.1250 NULL NULL NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 4ceedffa5cb..ec350b03e1b 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -287,6 +287,7 @@ column_stats CREATE TABLE `column_stats` ( `avg_length` decimal(12,4) DEFAULT NULL, `avg_frequency` decimal(12,4) DEFAULT NULL, `hist_size` tinyint(3) unsigned DEFAULT NULL, + `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') COLLATE utf8_bin DEFAULT NULL, `histogram` varbinary(255) DEFAULT NULL, PRIMARY KEY (`db_name`,`table_name`,`column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Columns' diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index bcd9c14f307..5bd4e176ea1 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -13,8 +13,9 @@ def mysql column_stats avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references def mysql column_stats column_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references def mysql column_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references -def mysql column_stats histogram 10 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) select,insert,update,references +def mysql column_stats histogram 11 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) select,insert,update,references def mysql column_stats hist_size 9 NULL YES tinyint NULL NULL 3 0 NULL NULL NULL tinyint(3) unsigned select,insert,update,references +def mysql column_stats hist_type 10 NULL YES enum 14 42 NULL NULL NULL utf8 utf8_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') select,insert,update,references def mysql column_stats max_value 5 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_bin varchar(255) select,insert,update,references def mysql column_stats min_value 4 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_bin varchar(255) select,insert,update,references def mysql column_stats nulls_ratio 6 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references @@ -332,6 +333,7 @@ NULL mysql column_stats nulls_ratio decimal NULL NULL NULL NULL decimal(12,4) NULL mysql column_stats avg_length decimal NULL NULL NULL NULL decimal(12,4) NULL mysql column_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4) NULL mysql column_stats hist_size tinyint NULL NULL NULL NULL tinyint(3) unsigned +3.0000 mysql column_stats hist_type enum 14 42 utf8 utf8_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') 1.0000 mysql column_stats histogram varbinary 255 255 NULL NULL varbinary(255) 3.0000 mysql db Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql db Db char 64 192 utf8 utf8_bin char(64) diff --git a/mysql-test/suite/sys_vars/r/histogram_type_basic.result b/mysql-test/suite/sys_vars/r/histogram_type_basic.result new file mode 100644 index 00000000000..f688a2a15fd --- /dev/null +++ b/mysql-test/suite/sys_vars/r/histogram_type_basic.result @@ -0,0 +1,79 @@ +SET @start_global_value = @@global.histogram_type; +SELECT @start_global_value; +@start_global_value +SINGLE_PREC_HB +SET @start_session_value = @@session.histogram_type; +SELECT @start_session_value; +@start_session_value +SINGLE_PREC_HB +SET @@global.histogram_type = 1; +SET @@global.histogram_type = DEFAULT; +SELECT @@global.histogram_type; +@@global.histogram_type +SINGLE_PREC_HB +SET @@global.histogram_type = 0; +SELECT @@global.histogram_type; +@@global.histogram_type +SINGLE_PREC_HB +SET @@global.histogram_type = 1; +SELECT @@global.histogram_type; +@@global.histogram_type +DOUBLE_PREC_HB +SET @@global.histogram_type = SINGLE_PREC_HB; +SELECT @@global.histogram_type; +@@global.histogram_type +SINGLE_PREC_HB +SET @@global.histogram_type = DOUBLE_PREC_HB; +SELECT @@global.histogram_type; +@@global.histogram_type +DOUBLE_PREC_HB +SET @@session.histogram_type = 0; +SELECT @@session.histogram_type; +@@session.histogram_type +SINGLE_PREC_HB +SET @@session.histogram_type = 1; +SELECT @@session.histogram_type; +@@session.histogram_type +DOUBLE_PREC_HB +SET @@session.histogram_type = SINGLE_PREC_HB; +SELECT @@session.histogram_type; +@@session.histogram_type +SINGLE_PREC_HB +SET @@session.histogram_type = DOUBLE_PREC_HB; +SELECT @@session.histogram_type; +@@session.histogram_type +DOUBLE_PREC_HB +set sql_mode=TRADITIONAL; +SET @@global.histogram_type = 10; +ERROR 42000: Variable 'histogram_type' can't be set to the value of '10' +SET @@global.histogram_type = -1024; +ERROR 42000: Variable 'histogram_type' can't be set to the value of '-1024' +SET @@global.histogram_type = 2.4; +ERROR 42000: Incorrect argument type to variable 'histogram_type' +SET @@global.histogram_type = OFF; +ERROR 42000: Variable 'histogram_type' can't be set to the value of 'OFF' +SET @@session.histogram_type = 10; +ERROR 42000: Variable 'histogram_type' can't be set to the value of '10' +SET @@session.histogram_type = -2; +ERROR 42000: Variable 'histogram_type' can't be set to the value of '-2' +SET @@session.histogram_type = 1.2; +ERROR 42000: Incorrect argument type to variable 'histogram_type' +SET @@session.histogram_type = ON; +ERROR 42000: Variable 'histogram_type' can't be set to the value of 'ON' +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='histogram_type'; +VARIABLE_NAME VARIABLE_VALUE +HISTOGRAM_TYPE DOUBLE_PREC_HB +SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='histogram_type'; +VARIABLE_NAME VARIABLE_VALUE +HISTOGRAM_TYPE DOUBLE_PREC_HB +SET @@global.histogram_type = @start_global_value; +SELECT @@global.histogram_type; +@@global.histogram_type +SINGLE_PREC_HB +SET @@session.histogram_type = @start_session_value; +SELECT @@session.histogram_type; +@@session.histogram_type +SINGLE_PREC_HB +set sql_mode=''; diff --git a/mysql-test/suite/sys_vars/t/histogram_type_basic.test b/mysql-test/suite/sys_vars/t/histogram_type_basic.test new file mode 100644 index 00000000000..bf1ef5ef700 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/histogram_type_basic.test @@ -0,0 +1,92 @@ +--source include/load_sysvars.inc + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.histogram_type; +SELECT @start_global_value; +SET @start_session_value = @@session.histogram_type; +SELECT @start_session_value; + +############################################################## +# Display the DEFAULT value of histogram_type # +############################################################## + +SET @@global.histogram_type = 1; +SET @@global.histogram_type = DEFAULT; +SELECT @@global.histogram_type; + +################################################################################# +# Change the value of histogram_type to a valid value for GLOBAL Scope # +################################################################################# + +SET @@global.histogram_type = 0; +SELECT @@global.histogram_type; +SET @@global.histogram_type = 1; +SELECT @@global.histogram_type; + +SET @@global.histogram_type = SINGLE_PREC_HB; +SELECT @@global.histogram_type; +SET @@global.histogram_type = DOUBLE_PREC_HB; +SELECT @@global.histogram_type; + +################################################################################### +# Change the value of histogram_type to a valid value for SESSION Scope # +################################################################################### + +SET @@session.histogram_type = 0; +SELECT @@session.histogram_type; +SET @@session.histogram_type = 1; +SELECT @@session.histogram_type; + +SET @@session.histogram_type = SINGLE_PREC_HB; +SELECT @@session.histogram_type; +SET @@session.histogram_type = DOUBLE_PREC_HB; +SELECT @@session.histogram_type; + +#################################################################### +# Change the value of histogram_type to an invalid value # +#################################################################### + +set sql_mode=TRADITIONAL; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.histogram_type = 10; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.histogram_type = -1024; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.histogram_type = 2.4; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.histogram_type = OFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.histogram_type = 10; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.histogram_type = -2; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.histogram_type = 1.2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.histogram_type = ON; + +############################################################################### +# Check if the value in GLOBAL & SESSION Tables matches value in variable # +############################################################################### + +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='histogram_type'; + +SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='histogram_type'; + +#################################### +# Restore initial value # +#################################### + +SET @@global.histogram_type = @start_global_value; +SELECT @@global.histogram_type; +SET @@session.histogram_type = @start_session_value; +SELECT @@session.histogram_type; +set sql_mode=''; + +##################################################### +# END OF histogram_type TESTS # +#####################################################
\ No newline at end of file diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index 5ec24d5f66e..9dda4af61eb 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -17,6 +17,7 @@ use dbt3_s001; set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; set @save_histogram_size=@@histogram_size; +set @save_histogram_type=@@histogram_type; --disable_query_log --disable_result_log @@ -168,32 +169,47 @@ set optimizer_use_condition_selectivity=1; eval EXPLAIN EXTENDED $Q20; eval $Q20; +SELECT ((SELECT COUNT(*) FROM part WHERE p_name LIKE 'g%') / + (SELECT COUNT(*) FROM part)) AS sel; + set optimizer_use_condition_selectivity=3; eval EXPLAIN EXTENDED $Q20; eval $Q20; set histogram_size=15; +ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES(); + flush table part; +set optimizer_use_condition_selectivity=4; +eval EXPLAIN EXTENDED $Q20; +eval $Q20; + +set histogram_type='DOUBLE_PREC_HB'; +set histogram_size=30; + ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES(); -set optimizer_use_condition_selectivity=4; +flush table part; + eval EXPLAIN EXTENDED $Q20; eval $Q20; +set histogram_type='SINGLE_PREC_HB'; set histogram_size=24; -flush table nation; - ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES(); +flush table nation; + eval EXPLAIN EXTENDED $Q20; eval $Q20; DROP DATABASE dbt3_s001; +set histogram_type=@save_histogram_type; set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; diff --git a/mysql-test/t/statistics.test b/mysql-test/t/statistics.test index 65412d849ed..2488e511bab 100644 --- a/mysql-test/t/statistics.test +++ b/mysql-test/t/statistics.test @@ -178,7 +178,21 @@ SELECT db_name, table_name, column_name, FROM mysql.column_stats; DELETE FROM mysql.column_stats; + +set histogram_size=8; +set histogram_type='DOUBLE_PREC_HB'; +ANALYZE TABLE t1; + +SELECT db_name, table_name, column_name, + min_value, max_value, + nulls_ratio, avg_frequency, + hist_size, HEX(histogram) + FROM mysql.column_stats; + +DELETE FROM mysql.column_stats; + set histogram_size= 0; +set histogram_type=default; ANALYZE TABLE t1; |