Commit 8d612adf authored by Igor Babaev's avatar Igor Babaev

Merge 5.5 -> 5.5-mwl248.

parents 4ffc9c3b 32443e74
......@@ -73,7 +73,8 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/debug_sync.cc ../sql/opt_table_elimination.cc
../sql/sql_prepare.cc ../sql/sql_rename.cc ../sql/sql_repl.cc
../sql/sql_select.cc ../sql/sql_servers.cc
../sql/sql_show.cc ../sql/sql_state.c ../sql/sql_string.cc
../sql/sql_show.cc ../sql/sql_state.c
../sql/sql_statistics.cc ../sql/sql_string.cc
../sql/sql_tablespace.cc ../sql/sql_table.cc ../sql/sql_test.cc
../sql/sql_trigger.cc ../sql/sql_udf.cc ../sql/sql_union.cc
../sql/sql_update.cc ../sql/sql_view.cc ../sql/sql_profile.cc
......
if (`select count(*) < 3 from information_schema.tables
where table_schema = 'mysql' and table_name in ('table_stat','column_stat','index_stat')`)
{
--skip Needs stat tables
}
--use-stat-tables='complementary'
......@@ -16,3 +16,6 @@ show create table proc;
show create table event;
show create table general_log;
show create table slow_log;
show create table table_stat;
show create table column_stat;
show create table index_stat;
CREATE TABLE Country (
Code char(3) NOT NULL default '',
Name char(52) NOT NULL default '',
SurfaceArea float(10,2) NOT NULL default '0.00',
Population int(11) NOT NULL default '0',
Capital int(11) default NULL,
PRIMARY KEY (Code),
UNIQUE INDEX (Name)
) CHARACTER SET utf8 COLLATE utf8_bin;
CREATE TABLE City (
ID int(11) NOT NULL auto_increment,
Name char(35) NOT NULL default '',
Country char(3) NOT NULL default '',
Population int(11) NOT NULL default '0',
PRIMARY KEY (ID),
INDEX (Population),
INDEX (Country)
) CHARACTER SET utf8 COLLATE utf8_bin;
CREATE TABLE CountryLanguage (
Country char(3) NOT NULL default '',
Language char(30) NOT NULL default '',
Percentage float(3,1) NOT NULL default '0.0',
PRIMARY KEY (Country, Language),
INDEX (Percentage)
) CHARACTER SET utf8 COLLATE utf8_bin;
......@@ -7,6 +7,7 @@ performance_schema
test
show tables in mysql;
Tables_in_mysql
column_stat
columns_priv
db
event
......@@ -17,6 +18,7 @@ help_keyword
help_relation
help_topic
host
index_stat
ndb_binlog_index
plugin
proc
......@@ -24,6 +26,7 @@ procs_priv
proxies_priv
servers
slow_log
table_stat
tables_priv
time_zone
time_zone_leap_second
......
drop table if exists t1,t2;
show tables;
Tables_in_mysql
column_stat
columns_priv
db
event
......@@ -11,6 +12,7 @@ help_keyword
help_relation
help_topic
host
index_stat
ndb_binlog_index
plugin
proc
......@@ -18,6 +20,7 @@ procs_priv
proxies_priv
servers
slow_log
table_stat
tables_priv
time_zone
time_zone_leap_second
......@@ -35,6 +38,7 @@ grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
show tables;
Tables_in_mysql
column_stat
columns_priv
db
event
......@@ -45,6 +49,7 @@ help_keyword
help_relation
help_topic
host
index_stat
ndb_binlog_index
plugin
proc
......@@ -52,6 +57,7 @@ procs_priv
proxies_priv
servers
slow_log
table_stat
tables_priv
time_zone
time_zone_leap_second
......@@ -77,6 +83,7 @@ ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password=old_password('gambling3');
show tables;
Tables_in_mysql
column_stat
columns_priv
db
event
......@@ -87,6 +94,7 @@ help_keyword
help_relation
help_topic
host
index_stat
ndb_binlog_index
plugin
proc
......@@ -94,6 +102,7 @@ procs_priv
proxies_priv
servers
slow_log
table_stat
tables_priv
time_zone
time_zone_leap_second
......
......@@ -81,6 +81,7 @@ TRIGGERS
USER_PRIVILEGES
USER_STATISTICS
VIEWS
column_stat
columns_priv
db
event
......@@ -91,6 +92,7 @@ help_keyword
help_relation
help_topic
host
index_stat
plugin
proc
procs_priv
......@@ -102,6 +104,7 @@ t2
t3
t4
t5
table_stat
tables_priv
time_zone
time_zone_leap_second
......@@ -120,6 +123,7 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_STATISTICS TABLE_STATISTICS
TRIGGERS TRIGGERS
table_stat table_stat
tables_priv tables_priv
time_zone time_zone
time_zone_leap_second time_zone_leap_second
......@@ -141,6 +145,7 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_STATISTICS TABLE_STATISTICS
TRIGGERS TRIGGERS
table_stat table_stat
tables_priv tables_priv
time_zone time_zone
time_zone_leap_second time_zone_leap_second
......@@ -162,6 +167,7 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_STATISTICS TABLE_STATISTICS
TRIGGERS TRIGGERS
table_stat table_stat
tables_priv tables_priv
time_zone time_zone
time_zone_leap_second time_zone_leap_second
......
......@@ -418,4 +418,4 @@ Wildcard: inf_rmation_schema
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 58
mysql 23
mysql 26
......@@ -19,6 +19,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -28,6 +29,7 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
......@@ -35,6 +37,7 @@ mysql.procs_priv OK
mysql.proxies_priv OK
mysql.renamed_general_log OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......
CREATE TABLE A (
pk INTEGER AUTO_INCREMENT PRIMARY KEY,
fdate DATE
) ENGINE=MyISAM;
CREATE PROCEDURE p_analyze()
BEGIN
DECLARE attempts INTEGER DEFAULT 100;
wl_loop: WHILE attempts > 0 DO
ANALYZE TABLE A;
SET attempts = attempts - 1;
END WHILE wl_loop;
END |
CREATE FUNCTION rnd3() RETURNS INT
BEGIN
RETURN ROUND(3 * RAND() + 0.5);
END |
SET GLOBAL use_stat_tables = PREFERABLY;
DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
SET GLOBAL use_stat_tables = DEFAULT;
......@@ -7,6 +7,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -16,12 +17,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -44,6 +47,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -53,12 +57,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -81,6 +87,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -90,12 +97,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -121,6 +130,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -130,12 +140,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -164,6 +176,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -173,12 +186,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -210,6 +225,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -219,12 +235,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -259,6 +277,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -268,12 +287,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......
......@@ -9,6 +9,7 @@ mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -18,12 +19,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......
......@@ -3,6 +3,7 @@ drop view if exists v1;
drop database if exists client_test_db;
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -12,12 +13,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -27,6 +30,7 @@ mysql.time_zone_transition_type OK
mysql.user OK
mtr.global_suppressions Table is already up to date
mtr.test_suppressions Table is already up to date
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -36,12 +40,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -49,6 +55,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
mysql.column_stat OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......@@ -58,12 +65,14 @@ mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stat OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.table_stat OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
......@@ -71,6 +80,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
mysql.column_stat Table is already up to date
mysql.columns_priv Table is already up to date
mysql.db Table is already up to date
mysql.event Table is already up to date
......@@ -80,12 +90,14 @@ mysql.help_keyword Table is already up to date
mysql.help_relation Table is already up to date
mysql.help_topic Table is already up to date
mysql.host Table is already up to date
mysql.index_stat Table is already up to date
mysql.ndb_binlog_index Table is already up to date
mysql.plugin Table is already up to date
mysql.proc Table is already up to date
mysql.procs_priv Table is already up to date
mysql.proxies_priv Table is already up to date
mysql.servers Table is already up to date
mysql.table_stat Table is already up to date
mysql.tables_priv Table is already up to date
mysql.time_zone Table is already up to date
mysql.time_zone_leap_second Table is already up to date
......
......@@ -843,6 +843,9 @@ The following options may be given as the first argument:
Prohibit update of a VIEW, which does not contain a key
of the underlying table and the query uses a LIMIT clause
(usually get from GUI tools)
--use-stat-tables=name
Specifies how to use system statistics tables. Possible
values are NEVER, COMPLEMENTARY, PREVERABLY
-u, --user=name Run mysqld daemon as user.
--userstat Enables statistics gathering for USER_STATISTICS,
CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS
......@@ -1096,6 +1099,7 @@ transaction-alloc-block-size 8192
transaction-isolation REPEATABLE-READ
transaction-prealloc-size 4096
updatable-views-with-limit YES
use-stat-tables NEVER
userstat FALSE
verbose TRUE
wait-timeout 28800
......
This diff is collapsed.
SET SESSION STORAGE_ENGINE='InnoDB';
select @@global.use_stat_tables;
@@global.use_stat_tables
NEVER
select @@session.use_stat_tables;
@@session.use_stat_tables
NEVER
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
DROP DATABASE IF EXISTS dbt3_s001;
CREATE DATABASE dbt3_s001;
use dbt3_s001;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
#
# Bug mdev-503: optimizer ignores setting use_stat_tables='preferably'
#
flush tables
customer, lineitem, nation, orders, part, partsupp, region, supplier;
set use_stat_tables='never';
EXPLAIN select sql_calc_found_rows straight_join
l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue,
o_orderdate, o_shippriority
from orders, customer, lineitem
where c_mktsegment = 'BUILDING' and c_custkey = o_custkey
and l_orderkey = o_orderkey and o_orderdate < date '1995-03-15'
and l_shipdate > date '1995-03-15'
group by l_orderkey, o_orderdate, o_shippriority
order by revenue desc, o_orderdate
limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL # Using where; Using temporary; Using filesort
1 SIMPLE customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey # Using where
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey # Using where
set use_stat_tables='preferably';
EXPLAIN select sql_calc_found_rows straight_join
l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue,
o_orderdate, o_shippriority
from orders, customer, lineitem
where c_mktsegment = 'BUILDING' and c_custkey = o_custkey
and l_orderkey = o_orderkey and o_orderdate < date '1995-03-15'
and l_shipdate > date '1995-03-15'
group by l_orderkey, o_orderdate, o_shippriority
order by revenue desc, o_orderdate
limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort
1 SIMPLE customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
flush tables customer, orders, lineitem;
EXPLAIN select sql_calc_found_rows straight_join
l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue,
o_orderdate, o_shippriority
from orders, customer, lineitem
where c_mktsegment = 'BUILDING' and c_custkey = o_custkey
and l_orderkey = o_orderkey and o_orderdate < date '1995-03-15'
and l_shipdate > date '1995-03-15'
group by l_orderkey, o_orderdate, o_shippriority
order by revenue desc, o_orderdate
limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort
1 SIMPLE customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
# End of the test case for mdev-503
set optimizer_switch=@save_optimizer_switch;
DROP DATABASE dbt3_s001;
use test;
set use_stat_tables=@save_use_stat_tables;
SET SESSION STORAGE_ENGINE=DEFAULT;
This diff is collapsed.
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
DROP DATABASE IF EXISTS dbt3_s001;
CREATE DATABASE dbt3_s001;
use dbt3_s001;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
select * from mysql.table_stat;
db_name table_name cardinality
dbt3_s001 customer 150
dbt3_s001 lineitem 6005
dbt3_s001 nation 25
dbt3_s001 orders 1500
dbt3_s001 part 200
dbt3_s001 partsupp 700
dbt3_s001 region 5
dbt3_s001 supplier 10
select * from mysql.index_stat;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 customer PRIMARY 1 1.0000
dbt3_s001 customer i_c_nationkey 1 6.0000
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_shipdate 1 2.6500
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_receiptdate 1 2.6477
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 nation PRIMARY 1 1.0000
dbt3_s001 nation i_n_regionkey 1 5.0000
dbt3_s001 orders PRIMARY 1 1.0000
dbt3_s001 orders i_o_orderdate 1 1.3321
dbt3_s001 orders i_o_custkey 1 15.0000
dbt3_s001 part PRIMARY 1 1.0000
dbt3_s001 partsupp PRIMARY 1 3.5000
dbt3_s001 partsupp PRIMARY 2 1.0000
dbt3_s001 partsupp i_ps_partkey 1 3.5000
dbt3_s001 partsupp i_ps_suppkey 1 70.0000
dbt3_s001 region PRIMARY 1 1.0000
dbt3_s001 supplier PRIMARY 1 1.0000
dbt3_s001 supplier i_s_nationkey 1 1.1111
flush table lineitem;
set use_stat_tables='never';
select sum(l_extendedprice*l_discount) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
revenue
77949.91860000002
set debug_sync='statistics_mem_alloc_start1 WAIT_FOR second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2 SIGNAL first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
select sum(l_extendedprice*l_discount) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24 ;
set debug_sync='statistics_mem_alloc_start1 SIGNAL second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2 WAIT_FOR first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
select sum(l_extendedprice*l_discount) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
revenue
77949.91860000002
revenue
77949.91860000002
set use_stat_tables='preferably';
set debug_sync='RESET';
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_receiptdate 1 2.6477
dbt3_s001 lineitem i_l_shipdate 1 2.6500
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
delete from mysql.index_stat
where table_name='lineitem' and
index_name in ('i_l_shipdate', 'i_l_receiptdate');
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
analyze table lineitem persistent for columns() indexes (i_l_shipdate);
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_shipdate 1 2.6500
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
delete from mysql.index_stat
where table_name='lineitem' and index_name= 'i_l_shipdate';
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
set debug_sync='statistics_collection_start1 WAIT_FOR second_thread_started_too';
set debug_sync='statistics_collection_start2 SIGNAL first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
analyze table lineitem persistent for columns() indexes (i_l_shipdate);
set debug_sync='statistics_collection_start1 SIGNAL second_thread_started_too';
set debug_sync='statistics_collection_start2 WAIT_FOR first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
analyze table lineitem persistent for columns() indexes (i_l_receiptdate);
set debug_sync='RESET';
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_receiptdate 1 2.6477
dbt3_s001 lineitem i_l_shipdate 1 2.6500
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
DROP DATABASE dbt3_s001;
use test;
set use_stat_tables=@save_use_stat_tables;
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
DROP DATABASE IF EXISTS dbt3_s001;
CREATE DATABASE dbt3_s001;
use dbt3_s001;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
select * from mysql.table_stat;
db_name table_name cardinality
dbt3_s001 customer 150
dbt3_s001 lineitem 6005
dbt3_s001 nation 25
dbt3_s001 orders 1500
dbt3_s001 part 200
dbt3_s001 partsupp 700
dbt3_s001 region 5
dbt3_s001 supplier 10
select * from mysql.index_stat;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 customer PRIMARY 1 1.0000
dbt3_s001 customer i_c_nationkey 1 6.0000
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_shipdate 1 2.6500
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_receiptdate 1 2.6477
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 nation PRIMARY 1 1.0000
dbt3_s001 nation i_n_regionkey 1 5.0000
dbt3_s001 orders PRIMARY 1 1.0000
dbt3_s001 orders i_o_orderdate 1 1.3321
dbt3_s001 orders i_o_custkey 1 15.0000
dbt3_s001 part PRIMARY 1 1.0000
dbt3_s001 partsupp PRIMARY 1 3.5000
dbt3_s001 partsupp PRIMARY 2 1.0000
dbt3_s001 partsupp i_ps_partkey 1 3.5000
dbt3_s001 partsupp i_ps_suppkey 1 70.0000
dbt3_s001 region PRIMARY 1 1.0000
dbt3_s001 supplier PRIMARY 1 1.0000
dbt3_s001 supplier i_s_nationkey 1 1.1111
flush table lineitem;
set use_stat_tables='never';
select sum(l_extendedprice*l_discount) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
revenue
77949.91860000002
set debug_sync='statistics_mem_alloc_start1 WAIT_FOR second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2 SIGNAL first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
select sum(l_extendedprice*l_discount) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24 ;
set debug_sync='statistics_mem_alloc_start1 SIGNAL second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2 WAIT_FOR first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
select sum(l_extendedprice*l_discount) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
revenue
77949.91860000002
revenue
77949.91860000002
set use_stat_tables='preferably';
set debug_sync='RESET';
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_receiptdate 1 2.6477
dbt3_s001 lineitem i_l_shipdate 1 2.6500
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
delete from mysql.index_stat
where table_name='lineitem' and
index_name in ('i_l_shipdate', 'i_l_receiptdate');
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
analyze table lineitem persistent for columns() indexes (i_l_shipdate);
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_shipdate 1 2.6500
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
delete from mysql.index_stat
where table_name='lineitem' and index_name= 'i_l_shipdate';
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
set debug_sync='statistics_collection_start1 WAIT_FOR second_thread_started_too';
set debug_sync='statistics_collection_start2 SIGNAL first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
analyze table lineitem persistent for columns() indexes (i_l_shipdate);
set debug_sync='statistics_collection_start1 SIGNAL second_thread_started_too';
set debug_sync='statistics_collection_start2 WAIT_FOR first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
analyze table lineitem persistent for columns() indexes (i_l_receiptdate);
set debug_sync='RESET';
select * from mysql.index_stat where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
dbt3_s001 lineitem PRIMARY 1 4.0033
dbt3_s001 lineitem PRIMARY 2 1.0000
dbt3_s001 lineitem i_l_commitdate 1 2.7160
dbt3_s001 lineitem i_l_orderkey 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033
dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404
dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_receiptdate 1 2.6477
dbt3_s001 lineitem i_l_shipdate 1 2.6500
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
DROP DATABASE dbt3_s001;
use test;
set use_stat_tables=@save_use_stat_tables;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
#
# Bug mdev-463: assertion failure when running ANALYZE with RBR on
#
SET GLOBAL use_stat_tables = PREFERABLY;
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
DROP TABLE t1;
SET GLOBAL use_stat_tables = DEFAULT;
SET use_stat_tables = PREFERABLY;
CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2;
ALTER TABLE t1 ANALYZE PARTITION p1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 245 Server ver: #, Binlog ver: #
master-bin.000001 245 Query 1 345 use `test`; CREATE TABLE t1 (i INT) ENGINE=InnoDB
master-bin.000001 345 Query 1 424 use `test`; ANALYZE TABLE t1
master-bin.000001 424 Query 1 528 use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 528 Query 1 664 use `test`; CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2
master-bin.000001 664 Query 1 762 use `test`; ALTER TABLE t1 ANALYZE PARTITION p1
SET use_stat_tables = DEFAULT;
DROP TABLE t1;
include/master-slave.inc
[connection master]
#
# Bug mdev-485: unexpected failure with replication of DROP/ALTER table
# when RBR is on
#
CREATE TABLE t1 ( a int, b int ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
DROP TABLE t1;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
DROP INDEX idx1 ON t1;
DROP TABLE t1;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
ALTER TABLE t1 DROP COLUMN b;
DROP TABLE t1;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
ALTER TABLE t1 RENAME to s;
DROP TABLE s;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
ALTER TABLE t1 CHANGE COLUMN b c int ;
DROP TABLE t1;
include/rpl_end.inc
This diff is collapsed.
......@@ -107,7 +107,7 @@ Handler_mrr_key_refills 0
Handler_mrr_rowid_refills 0
Handler_prepare 18
Handler_read_first 0
Handler_read_key 3
Handler_read_key 9
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
......@@ -123,7 +123,7 @@ Handler_update 5
Handler_write 7
select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key";
handler_read_key
3
9
set @@global.userstat=0;
select * from information_schema.index_statistics;
TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ
......
show tables;
Tables_in_db
column_stat
columns_priv
db
event
......@@ -10,6 +11,7 @@ help_keyword
help_relation
help_topic
host
index_stat
ndb_binlog_index
plugin
proc
......@@ -17,6 +19,7 @@ procs_priv
proxies_priv
servers
slow_log
table_stat
tables_priv
time_zone
time_zone_leap_second
......@@ -264,5 +267,36 @@ slow_log CREATE TABLE `slow_log` (
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show create table table_stat;
Table Create Table
table_stat CREATE TABLE `table_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`cardinality` bigint(21) unsigned DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Tables'
show create table column_stat;
Table Create Table
column_stat CREATE TABLE `column_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`column_name` varchar(64) COLLATE utf8_bin NOT NULL,
`min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`nulls_ratio` decimal(12,4) DEFAULT NULL,
`avg_length` decimal(12,4) DEFAULT NULL,
`avg_frequency` decimal(12,4) DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Columns'
show create table index_stat;
Table Create Table
index_stat CREATE TABLE `index_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`index_name` varchar(64) COLLATE utf8_bin NOT NULL,
`prefix_arity` int(11) unsigned NOT NULL,
`avg_frequency` decimal(12,4) DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Indexes'
show tables;
Tables_in_test
show tables;
Tables_in_db
column_stat
columns_priv
db
event
......@@ -10,6 +11,7 @@ help_keyword
help_relation
help_topic
host
index_stat
ndb_binlog_index
plugin
proc
......@@ -17,6 +19,7 @@ procs_priv
proxies_priv
servers
slow_log
table_stat
tables_priv
time_zone
time_zone_leap_second
......@@ -264,5 +267,36 @@ slow_log CREATE TABLE `slow_log` (
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show create table table_stat;
Table Create Table
table_stat CREATE TABLE `table_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`cardinality` bigint(21) unsigned DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Tables'
show create table column_stat;
Table Create Table
column_stat CREATE TABLE `column_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`column_name` varchar(64) COLLATE utf8_bin NOT NULL,
`min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`nulls_ratio` double DEFAULT NULL,
`avg_length` double DEFAULT NULL,
`avg_frequency` double DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Columns'
show create table index_stat;
Table Create Table
index_stat CREATE TABLE `index_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`index_name` varchar(64) COLLATE utf8_bin NOT NULL,
`prefix_arity` int(11) unsigned NOT NULL,
`avg_frequency` double DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Indexes'
show tables;
Tables_in_test
show tables;
Tables_in_db
column_stat
columns_priv
db
event
......@@ -10,6 +11,7 @@ help_keyword
help_relation
help_topic
host
index_stat
ndb_binlog_index
plugin
proc
......@@ -17,6 +19,7 @@ procs_priv
proxies_priv
servers
slow_log
table_stat
tables_priv
time_zone
time_zone_leap_second
......@@ -264,5 +267,36 @@ slow_log CREATE TABLE `slow_log` (
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show create table table_stat;
Table Create Table
table_stat CREATE TABLE `table_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`cardinality` bigint(21) unsigned DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Tables'
show create table column_stat;
Table Create Table
column_stat CREATE TABLE `column_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`column_name` varchar(64) COLLATE utf8_bin NOT NULL,
`min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`nulls_ratio` double DEFAULT NULL,
`avg_length` double DEFAULT NULL,
`avg_frequency` double DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Columns'
show create table index_stat;
Table Create Table
index_stat CREATE TABLE `index_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`index_name` varchar(64) COLLATE utf8_bin NOT NULL,
`prefix_arity` int(11) unsigned NOT NULL,
`avg_frequency` double DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Indexes'
show tables;
Tables_in_test
show tables;
Tables_in_db
column_stat
columns_priv
db
event
......@@ -10,6 +11,7 @@ help_keyword
help_relation
help_topic
host
index_stat
ndb_binlog_index
plugin
proc
......@@ -17,6 +19,7 @@ procs_priv
proxies_priv
servers
slow_log
table_stat
tables_priv
time_zone
time_zone_leap_second
......@@ -264,5 +267,36 @@ slow_log CREATE TABLE `slow_log` (
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show create table table_stat;
Table Create Table
table_stat CREATE TABLE `table_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`cardinality` bigint(21) unsigned DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Tables'
show create table column_stat;
Table Create Table
column_stat CREATE TABLE `column_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`column_name` varchar(64) COLLATE utf8_bin NOT NULL,
`min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`nulls_ratio` double DEFAULT NULL,
`avg_length` double DEFAULT NULL,
`avg_frequency` double DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Columns'
show create table index_stat;
Table Create Table
index_stat CREATE TABLE `index_stat` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`index_name` varchar(64) COLLATE utf8_bin NOT NULL,
`prefix_arity` int(11) unsigned NOT NULL,
`avg_frequency` double DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Indexes'
show tables;
Tables_in_test
......@@ -9,6 +9,14 @@ def mysql columns_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(
def mysql columns_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references
def mysql columns_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql columns_priv User 3 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
def mysql column_stat avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references
def mysql column_stat avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references
def mysql column_stat column_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql column_stat db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql column_stat max_value 5 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_bin varchar(255) select,insert,update,references
def mysql column_stat min_value 4 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_bin varchar(255) select,insert,update,references
def mysql column_stat nulls_ratio 6 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references
def mysql column_stat table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql db Alter_priv 13 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql db Alter_routine_priv 19 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql db Create_priv 8 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
......@@ -97,6 +105,11 @@ def mysql host Select_priv 3 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci e
def mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql host Update_priv 5 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql index_stat avg_frequency 5 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references
def mysql index_stat db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql index_stat index_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql index_stat prefix_arity 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned PRI select,insert,update,references
def mysql index_stat table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI select,insert,update,references
def mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL NULL latin1 latin1_swedish_ci varchar(255) select,insert,update,references
......@@ -169,6 +182,9 @@ def mysql tables_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin
def mysql tables_priv Table_priv 7 NO set 98 294 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') select,insert,update,references
def mysql tables_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql tables_priv User 3 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
def mysql table_stat cardinality 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references
def mysql table_stat db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql table_stat table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql time_zone Time_zone_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI auto_increment select,insert,update,references
def mysql time_zone Use_leap_seconds 2 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('Y','N') select,insert,update,references
def mysql time_zone_leap_second Correction 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references
......@@ -258,6 +274,7 @@ ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
3.0000 char utf8 utf8_bin
3.0000 enum utf8 utf8_bin
3.0000 varchar utf8 utf8_bin
3.0000 char utf8 utf8_general_ci
3.0000 enum utf8 utf8_general_ci
3.0000 set utf8 utf8_general_ci
......@@ -274,6 +291,7 @@ ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
NULL bigint NULL NULL
NULL datetime NULL NULL
NULL decimal NULL NULL
NULL int NULL NULL
NULL smallint NULL NULL
NULL time NULL NULL
......@@ -302,6 +320,14 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C
3.0000 mysql columns_priv Column_name char 64 192 utf8 utf8_bin char(64)
NULL mysql columns_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql columns_priv Column_priv set 31 93 utf8 utf8_general_ci set('Select','Insert','Update','References')
3.0000 mysql column_stat db_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stat table_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stat column_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stat min_value varchar 255 765 utf8 utf8_bin varchar(255)
3.0000 mysql column_stat max_value varchar 255 765 utf8 utf8_bin varchar(255)
NULL mysql column_stat nulls_ratio decimal NULL NULL NULL NULL decimal(12,4)
NULL mysql column_stat avg_length decimal NULL NULL NULL NULL decimal(12,4)
NULL mysql column_stat avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
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)
3.0000 mysql db User char 16 48 utf8 utf8_bin char(16)
......@@ -390,6 +416,11 @@ NULL mysql help_topic help_category_id smallint NULL NULL NULL NULL smallint(5)
3.0000 mysql host Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql host Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql host Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql index_stat db_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql index_stat table_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql index_stat index_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql index_stat prefix_arity int NULL NULL NULL NULL int(11) unsigned
NULL mysql index_stat avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
NULL mysql ndb_binlog_index Position bigint NULL NULL NULL NULL bigint(20) unsigned
1.0000 mysql ndb_binlog_index File varchar 255 255 latin1 latin1_swedish_ci varchar(255)
NULL mysql ndb_binlog_index epoch bigint NULL NULL NULL NULL bigint(20) unsigned
......@@ -462,6 +493,9 @@ NULL mysql slow_log server_id int NULL NULL NULL NULL int(10) unsigned
NULL mysql tables_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql tables_priv Table_priv set 98 294 utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger')
3.0000 mysql tables_priv Column_priv set 31 93 utf8 utf8_general_ci set('Select','Insert','Update','References')
3.0000 mysql table_stat db_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql table_stat table_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql table_stat cardinality bigint NULL NULL NULL NULL bigint(21) unsigned
NULL mysql time_zone Time_zone_id int NULL NULL NULL NULL int(10) unsigned
3.0000 mysql time_zone Use_leap_seconds enum 1 3 utf8 utf8_general_ci enum('Y','N')
NULL mysql time_zone_leap_second Transition_time bigint NULL NULL NULL NULL bigint(20)
......
......@@ -9,6 +9,14 @@ def mysql columns_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(
def mysql columns_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI
def mysql columns_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP
def mysql columns_priv User 3 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI
def mysql column_stat avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4)
def mysql column_stat avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4)
def mysql column_stat column_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI
def mysql column_stat db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI
def mysql column_stat max_value 5 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_bin varchar(255)
def mysql column_stat min_value 4 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_bin varchar(255)
def mysql column_stat nulls_ratio 6 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4)
def mysql column_stat table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI
def mysql db Alter_priv 13 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y')
def mysql db Alter_routine_priv 19 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y')
def mysql db Create_priv 8 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y')
......@@ -97,6 +105,11 @@ def mysql host Select_priv 3 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci e
def mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y')
def mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y')
def mysql host Update_priv 5 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y')
def mysql index_stat avg_frequency 5 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4)
def mysql index_stat db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI
def mysql index_stat index_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI
def mysql index_stat prefix_arity 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned PRI
def mysql index_stat table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI
def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned
def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI
def mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL NULL latin1 latin1_swedish_ci varchar(255)
......@@ -169,6 +182,9 @@ def mysql tables_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin
def mysql tables_priv Table_priv 7 NO set 98 294 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger')
def mysql tables_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP
def mysql tables_priv User 3 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI
def mysql table_stat cardinality 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned
def mysql table_stat db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI
def mysql table_stat table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI
def mysql time_zone Time_zone_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI auto_increment
def mysql time_zone Use_leap_seconds 2 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('Y','N')
def mysql time_zone_leap_second Correction 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11)
......@@ -258,6 +274,7 @@ ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
3.0000 char utf8 utf8_bin
3.0000 enum utf8 utf8_bin
3.0000 varchar utf8 utf8_bin
3.0000 char utf8 utf8_general_ci
3.0000 enum utf8 utf8_general_ci
3.0000 set utf8 utf8_general_ci
......@@ -274,6 +291,7 @@ ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
NULL bigint NULL NULL
NULL datetime NULL NULL
NULL decimal NULL NULL
NULL int NULL NULL
NULL smallint NULL NULL
NULL time NULL NULL
......@@ -302,6 +320,14 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C
3.0000 mysql columns_priv Column_name char 64 192 utf8 utf8_bin char(64)
NULL mysql columns_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql columns_priv Column_priv set 31 93 utf8 utf8_general_ci set('Select','Insert','Update','References')
3.0000 mysql column_stat db_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stat table_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stat column_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql column_stat min_value varchar 255 765 utf8 utf8_bin varchar(255)
3.0000 mysql column_stat max_value varchar 255 765 utf8 utf8_bin varchar(255)
NULL mysql column_stat nulls_ratio decimal NULL NULL NULL NULL decimal(12,4)
NULL mysql column_stat avg_length decimal NULL NULL NULL NULL decimal(12,4)
NULL mysql column_stat avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
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)
3.0000 mysql db User char 16 48 utf8 utf8_bin char(16)
......@@ -390,6 +416,11 @@ NULL mysql help_topic help_category_id smallint NULL NULL NULL NULL smallint(5)
3.0000 mysql host Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql host Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql host Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql index_stat db_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql index_stat table_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql index_stat index_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql index_stat prefix_arity int NULL NULL NULL NULL int(11) unsigned
NULL mysql index_stat avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
NULL mysql ndb_binlog_index Position bigint NULL NULL NULL NULL bigint(20) unsigned
1.0000 mysql ndb_binlog_index File varchar 255 255 latin1 latin1_swedish_ci varchar(255)
NULL mysql ndb_binlog_index epoch bigint NULL NULL NULL NULL bigint(20) unsigned
......@@ -462,6 +493,9 @@ NULL mysql slow_log server_id int NULL NULL NULL NULL int(10) unsigned
NULL mysql tables_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql tables_priv Table_priv set 98 294 utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger')
3.0000 mysql tables_priv Column_priv set 31 93 utf8 utf8_general_ci set('Select','Insert','Update','References')
3.0000 mysql table_stat db_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql table_stat table_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql table_stat cardinality bigint NULL NULL NULL NULL bigint(21) unsigned
NULL mysql time_zone Time_zone_id int NULL NULL NULL NULL int(10) unsigned
3.0000 mysql time_zone Use_leap_seconds enum 1 3 utf8 utf8_general_ci enum('Y','N')
NULL mysql time_zone_leap_second Transition_time bigint NULL NULL NULL NULL bigint(20)
......
......@@ -75,6 +75,9 @@ table_schema, table_name, column_name
FROM information_schema.key_column_usage
WHERE constraint_catalog IS NOT NULL OR table_catalog IS NOT NULL;
constraint_catalog constraint_schema constraint_name table_catalog table_schema table_name column_name
def mysql PRIMARY def mysql column_stat db_name
def mysql PRIMARY def mysql column_stat table_name
def mysql PRIMARY def mysql column_stat column_name
def mysql PRIMARY def mysql columns_priv Host
def mysql PRIMARY def mysql columns_priv Db
def mysql PRIMARY def mysql columns_priv User
......@@ -96,6 +99,10 @@ def mysql PRIMARY def mysql help_topic help_topic_id
def mysql name def mysql help_topic name
def mysql PRIMARY def mysql host Host
def mysql PRIMARY def mysql host Db
def mysql PRIMARY def mysql index_stat db_name
def mysql PRIMARY def mysql index_stat table_name
def mysql PRIMARY def mysql index_stat index_name
def mysql PRIMARY def mysql index_stat prefix_arity
def mysql PRIMARY def mysql ndb_binlog_index epoch
def mysql PRIMARY def mysql plugin name
def mysql PRIMARY def mysql proc db
......@@ -111,6 +118,8 @@ def mysql PRIMARY def mysql proxies_priv User
def mysql PRIMARY def mysql proxies_priv Proxied_host
def mysql PRIMARY def mysql proxies_priv Proxied_user
def mysql PRIMARY def mysql servers Server_name
def mysql PRIMARY def mysql table_stat db_name
def mysql PRIMARY def mysql table_stat table_name
def mysql PRIMARY def mysql tables_priv Host
def mysql PRIMARY def mysql tables_priv Db
def mysql PRIMARY def mysql tables_priv User
......
......@@ -85,6 +85,9 @@ INDEX_COMMENT varchar(1024) NO
SELECT table_catalog, table_schema, table_name, index_schema, index_name
FROM information_schema.statistics WHERE table_catalog IS NOT NULL;
table_catalog table_schema table_name index_schema index_name
def mysql column_stat mysql PRIMARY
def mysql column_stat mysql PRIMARY
def mysql column_stat mysql PRIMARY
def mysql columns_priv mysql PRIMARY
def mysql columns_priv mysql PRIMARY
def mysql columns_priv mysql PRIMARY
......@@ -107,6 +110,10 @@ def mysql help_topic mysql PRIMARY
def mysql help_topic mysql name
def mysql host mysql PRIMARY
def mysql host mysql PRIMARY
def mysql index_stat mysql PRIMARY
def mysql index_stat mysql PRIMARY
def mysql index_stat mysql PRIMARY
def mysql index_stat mysql PRIMARY
def mysql ndb_binlog_index mysql PRIMARY
def mysql plugin mysql PRIMARY
def mysql proc mysql PRIMARY
......@@ -124,6 +131,8 @@ def mysql proxies_priv mysql PRIMARY
def mysql proxies_priv mysql PRIMARY
def mysql proxies_priv mysql Grantor
def mysql servers mysql PRIMARY
def mysql table_stat mysql PRIMARY
def mysql table_stat mysql PRIMARY
def mysql tables_priv mysql PRIMARY
def mysql tables_priv mysql PRIMARY
def mysql tables_priv mysql PRIMARY
......
......@@ -12,6 +12,9 @@ def mysql columns_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 5 Column_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 3 column_name A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
......@@ -29,6 +32,10 @@ def mysql help_topic 0 mysql name 1 name A #CARD# NULL NULL BTREE
def mysql help_topic 0 mysql PRIMARY 1 help_topic_id A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 3 index_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 4 prefix_arity A #CARD# NULL NULL BTREE
def mysql ndb_binlog_index 0 mysql PRIMARY 1 epoch A #CARD# NULL NULL BTREE
def mysql plugin 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
def mysql proc 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
......@@ -51,6 +58,8 @@ def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE
def mysql table_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql table_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql time_zone 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE
def mysql time_zone_leap_second 0 mysql PRIMARY 1 Transition_time A #CARD# NULL NULL BTREE
def mysql time_zone_name 0 mysql PRIMARY 1 Name A #CARD# NULL NULL BTREE
......
......@@ -12,6 +12,9 @@ def mysql columns_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 5 Column_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 3 column_name A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
......@@ -29,6 +32,10 @@ def mysql help_topic 0 mysql name 1 name A #CARD# NULL NULL BTREE
def mysql help_topic 0 mysql PRIMARY 1 help_topic_id A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 3 index_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 4 prefix_arity A #CARD# NULL NULL BTREE
def mysql ndb_binlog_index 0 mysql PRIMARY 1 epoch A #CARD# NULL NULL BTREE
def mysql plugin 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
def mysql proc 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
......@@ -51,6 +58,8 @@ def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE
def mysql table_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql table_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql time_zone 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE
def mysql time_zone_leap_second 0 mysql PRIMARY 1 Transition_time A #CARD# NULL NULL BTREE
def mysql time_zone_name 0 mysql PRIMARY 1 Name A #CARD# NULL NULL BTREE
......@@ -70,6 +79,9 @@ def mysql columns_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE
def mysql columns_priv 0 mysql PRIMARY 5 Column_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql column_stat 0 mysql PRIMARY 3 column_name A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql db 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
......@@ -87,6 +99,10 @@ def mysql help_topic 0 mysql name 1 name A #CARD# NULL NULL BTREE
def mysql help_topic 0 mysql PRIMARY 1 help_topic_id A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql host 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 3 index_name A #CARD# NULL NULL BTREE
def mysql index_stat 0 mysql PRIMARY 4 prefix_arity A #CARD# NULL NULL BTREE
def mysql ndb_binlog_index 0 mysql PRIMARY 1 epoch A #CARD# NULL NULL BTREE
def mysql plugin 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE
def mysql proc 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE
......@@ -109,6 +125,8 @@ def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 4 Table_name A #CARD# NULL NULL BTREE
def mysql table_stat 0 mysql PRIMARY 1 db_name A #CARD# NULL NULL BTREE
def mysql table_stat 0 mysql PRIMARY 2 table_name A #CARD# NULL NULL BTREE
def mysql time_zone 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL NULL BTREE
def mysql time_zone_leap_second 0 mysql PRIMARY 1 Transition_time A #CARD# NULL NULL BTREE
def mysql time_zone_name 0 mysql PRIMARY 1 Name A #CARD# NULL NULL BTREE
......
......@@ -57,6 +57,7 @@ table_schema, table_name
FROM information_schema.table_constraints
WHERE constraint_catalog IS NOT NULL;
constraint_catalog constraint_schema constraint_name table_schema table_name
def mysql PRIMARY mysql column_stat
def mysql PRIMARY mysql columns_priv
def mysql PRIMARY mysql db
def mysql PRIMARY mysql event
......@@ -69,12 +70,14 @@ def mysql PRIMARY mysql help_relation
def mysql PRIMARY mysql help_topic
def mysql name mysql help_topic
def mysql PRIMARY mysql host
def mysql PRIMARY mysql index_stat
def mysql PRIMARY mysql ndb_binlog_index
def mysql PRIMARY mysql plugin
def mysql PRIMARY mysql proc
def mysql PRIMARY mysql procs_priv
def mysql PRIMARY mysql proxies_priv
def mysql PRIMARY mysql servers
def mysql PRIMARY mysql table_stat
def mysql PRIMARY mysql tables_priv
def mysql PRIMARY mysql time_zone
def mysql PRIMARY mysql time_zone_leap_second
......
......@@ -8,6 +8,7 @@ WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name,constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
def mysql PRIMARY mysql columns_priv PRIMARY KEY
def mysql PRIMARY mysql column_stat PRIMARY KEY
def mysql PRIMARY mysql db PRIMARY KEY
def mysql PRIMARY mysql event PRIMARY KEY
def mysql PRIMARY mysql func PRIMARY KEY
......@@ -19,6 +20,7 @@ def mysql PRIMARY mysql help_relation PRIMARY KEY
def mysql name mysql help_topic UNIQUE
def mysql PRIMARY mysql help_topic PRIMARY KEY
def mysql PRIMARY mysql host PRIMARY KEY
def mysql PRIMARY mysql index_stat PRIMARY KEY
def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
......@@ -26,6 +28,7 @@ def mysql PRIMARY mysql procs_priv PRIMARY KEY
def mysql PRIMARY mysql proxies_priv PRIMARY KEY
def mysql PRIMARY mysql servers PRIMARY KEY
def mysql PRIMARY mysql tables_priv PRIMARY KEY
def mysql PRIMARY mysql table_stat PRIMARY KEY
def mysql PRIMARY mysql time_zone PRIMARY KEY
def mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY
def mysql PRIMARY mysql time_zone_name PRIMARY KEY
......
......@@ -8,6 +8,7 @@ WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name,constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
def mysql PRIMARY mysql columns_priv PRIMARY KEY
def mysql PRIMARY mysql column_stat PRIMARY KEY
def mysql PRIMARY mysql db PRIMARY KEY
def mysql PRIMARY mysql event PRIMARY KEY
def mysql PRIMARY mysql func PRIMARY KEY
......@@ -19,6 +20,7 @@ def mysql PRIMARY mysql help_relation PRIMARY KEY
def mysql name mysql help_topic UNIQUE
def mysql PRIMARY mysql help_topic PRIMARY KEY
def mysql PRIMARY mysql host PRIMARY KEY
def mysql PRIMARY mysql index_stat PRIMARY KEY
def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
......@@ -26,6 +28,7 @@ def mysql PRIMARY mysql procs_priv PRIMARY KEY
def mysql PRIMARY mysql proxies_priv PRIMARY KEY
def mysql PRIMARY mysql servers PRIMARY KEY
def mysql PRIMARY mysql tables_priv PRIMARY KEY
def mysql PRIMARY mysql table_stat PRIMARY KEY
def mysql PRIMARY mysql time_zone PRIMARY KEY
def mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY
def mysql PRIMARY mysql time_zone_name PRIMARY KEY
......@@ -38,6 +41,7 @@ WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name,constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
def mysql PRIMARY mysql columns_priv PRIMARY KEY
def mysql PRIMARY mysql column_stat PRIMARY KEY
def mysql PRIMARY mysql db PRIMARY KEY
def mysql PRIMARY mysql event PRIMARY KEY
def mysql PRIMARY mysql func PRIMARY KEY
......@@ -49,6 +53,7 @@ def mysql PRIMARY mysql help_relation PRIMARY KEY
def mysql name mysql help_topic UNIQUE
def mysql PRIMARY mysql help_topic PRIMARY KEY
def mysql PRIMARY mysql host PRIMARY KEY
def mysql PRIMARY mysql index_stat PRIMARY KEY
def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
......@@ -56,6 +61,7 @@ def mysql PRIMARY mysql procs_priv PRIMARY KEY
def mysql PRIMARY mysql proxies_priv PRIMARY KEY
def mysql PRIMARY mysql servers PRIMARY KEY
def mysql PRIMARY mysql tables_priv PRIMARY KEY
def mysql PRIMARY mysql table_stat PRIMARY KEY
def mysql PRIMARY mysql time_zone PRIMARY KEY
def mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY
def mysql PRIMARY mysql time_zone_name PRIMARY KEY
......
......@@ -37,6 +37,29 @@ user_comment Column privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME column_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Columns
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME db
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......@@ -244,6 +267,29 @@ user_comment Host privileges; Merged with database privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME index_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Indexes
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME ndb_binlog_index
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......@@ -428,6 +474,29 @@ user_comment Table privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME table_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Tables
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME time_zone
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......
......@@ -37,6 +37,29 @@ user_comment Column privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME column_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Columns
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME db
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......@@ -244,6 +267,29 @@ user_comment Host privileges; Merged with database privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME index_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Indexes
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME ndb_binlog_index
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......@@ -428,6 +474,29 @@ user_comment Table privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME table_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Tables
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME time_zone
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......@@ -605,6 +674,29 @@ user_comment Column privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME column_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Columns
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME db
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......@@ -812,6 +904,29 @@ user_comment Host privileges; Merged with database privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME index_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Indexes
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME ndb_binlog_index
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......@@ -996,6 +1111,29 @@ user_comment Table privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME table_stat
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_bin
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Statistics on Tables
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME time_zone
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
......
......@@ -17,6 +17,7 @@ substring(object_name, locate("no_index_tab", object_name)) as short_name
from performance_schema.events_waits_history_long
where operation not like "tell"
and event_name like "wait/io/file/myisam/%"
having short_name <> ""
order by thread_id, event_id;
event_name short_source operation number_of_bytes short_name
wait/io/file/myisam/kfile mi_create.c: create NULL no_index_tab.MYI
......
......@@ -25,7 +25,7 @@ ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database.
ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_table";
Tables_in_performance_schema (user_table)
......@@ -55,7 +55,7 @@ ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database.
ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_view";
Tables_in_performance_schema (user_view)
......@@ -83,7 +83,7 @@ ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database.
ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
......@@ -111,7 +111,7 @@ ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database.
ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
......@@ -139,7 +139,7 @@ ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
ERROR 1050 (42S01) at line 478: Table 'threads' already exists
ERROR 1644 (HY000) at line 1126: Unexpected content found in the performance_schema database.
ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.event where db='performance_schema';
name
......
......@@ -46,6 +46,7 @@ select event_name,
from performance_schema.events_waits_history_long
where operation not like "tell"
and event_name like "wait/io/file/myisam/%"
having short_name <> ""
order by thread_id, event_id;
# In case of failures, this will tell if file io are lost.
......
SET @start_global_value = @@global.use_stat_tables;
SELECT @start_global_value;
@start_global_value
NEVER
SET @start_session_value = @@session.use_stat_tables;
SELECT @start_session_value;
@start_session_value
NEVER
SET @@global.use_stat_tables = 2;
SET @@global.use_stat_tables = DEFAULT;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
NEVER
SET @@global.use_stat_tables = 0;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
NEVER
SET @@global.use_stat_tables = 1;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
COMPLEMENTARY
SET @@global.use_stat_tables = 2;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
PREFERABLY
SET @@global.use_stat_tables = NEVER;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
NEVER
SET @@global.use_stat_tables = COMPLEMENTARY;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
COMPLEMENTARY
SET @@global.use_stat_tables = PREFERABLY;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
PREFERABLY
SET @@session.use_stat_tables = 0;
SELECT @@session.use_stat_tables;
@@session.use_stat_tables
NEVER
SET @@session.use_stat_tables = 1;
SELECT @@session.use_stat_tables;
@@session.use_stat_tables
COMPLEMENTARY
SET @@session.use_stat_tables = 2;
SELECT @@session.use_stat_tables;
@@session.use_stat_tables
PREFERABLY
SET @@session.use_stat_tables = NEVER;
SELECT @@session.use_stat_tables;
@@session.use_stat_tables
NEVER
SET @@session.use_stat_tables = PREFERABLY;
SELECT @@session.use_stat_tables;
@@session.use_stat_tables
PREFERABLY
SET @@session.use_stat_tables = COMPLEMENTARY;
SELECT @@session.use_stat_tables;
@@session.use_stat_tables
COMPLEMENTARY
set sql_mode=TRADITIONAL;
SET @@global.use_stat_tables = 10;
ERROR 42000: Variable 'use_stat_tables' can't be set to the value of '10'
SET @@global.use_stat_tables = -1024;
ERROR 42000: Variable 'use_stat_tables' can't be set to the value of '-1024'
SET @@global.use_stat_tables = 2.4;
ERROR 42000: Incorrect argument type to variable 'use_stat_tables'
SET @@global.use_stat_tables = OFF;
ERROR 42000: Variable 'use_stat_tables' can't be set to the value of 'OFF'
SET @@session.use_stat_tables = 10;
ERROR 42000: Variable 'use_stat_tables' can't be set to the value of '10'
SET @@session.use_stat_tables = -2;
ERROR 42000: Variable 'use_stat_tables' can't be set to the value of '-2'
SET @@session.use_stat_tables = 1.2;
ERROR 42000: Incorrect argument type to variable 'use_stat_tables'
SET @@session.use_stat_tables = ON;
ERROR 42000: Variable 'use_stat_tables' can't be set to the value of 'ON'
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='use_stat_tables';
VARIABLE_NAME VARIABLE_VALUE
USE_STAT_TABLES PREFERABLY
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='use_stat_tables';
VARIABLE_NAME VARIABLE_VALUE
USE_STAT_TABLES COMPLEMENTARY
SET @@global.use_stat_tables = @start_global_value;
SELECT @@global.use_stat_tables;
@@global.use_stat_tables
NEVER
SET @@session.use_stat_tables = @start_session_value;
SELECT @@session.use_stat_tables;
@@session.use_stat_tables
NEVER
set sql_mode='';
--source include/load_sysvars.inc
#############################################################
# Save initial value #
#############################################################
SET @start_global_value = @@global.use_stat_tables;
SELECT @start_global_value;
SET @start_session_value = @@session.use_stat_tables;
SELECT @start_session_value;
###############################################################
# Display the DEFAULT value of use_stat_tables #
###############################################################
SET @@global.use_stat_tables = 2;
SET @@global.use_stat_tables = DEFAULT;
SELECT @@global.use_stat_tables;
##################################################################################
# Change the value of use_stat_tables to a valid value for GLOBAL Scope #
##################################################################################
SET @@global.use_stat_tables = 0;
SELECT @@global.use_stat_tables;
SET @@global.use_stat_tables = 1;
SELECT @@global.use_stat_tables;
SET @@global.use_stat_tables = 2;
SELECT @@global.use_stat_tables;
SET @@global.use_stat_tables = NEVER;
SELECT @@global.use_stat_tables;
SET @@global.use_stat_tables = COMPLEMENTARY;
SELECT @@global.use_stat_tables;
SET @@global.use_stat_tables = PREFERABLY;
SELECT @@global.use_stat_tables;
####################################################################################
# Change the value of use_stat_tables to a valid value for SESSION Scope #
####################################################################################
SET @@session.use_stat_tables = 0;
SELECT @@session.use_stat_tables;
SET @@session.use_stat_tables = 1;
SELECT @@session.use_stat_tables;
SET @@session.use_stat_tables = 2;
SELECT @@session.use_stat_tables;
SET @@session.use_stat_tables = NEVER;
SELECT @@session.use_stat_tables;
SET @@session.use_stat_tables = PREFERABLY;
SELECT @@session.use_stat_tables;
SET @@session.use_stat_tables = COMPLEMENTARY;
SELECT @@session.use_stat_tables;
#####################################################################
# Change the value of use_stat_tables to an invalid value #
#####################################################################
set sql_mode=TRADITIONAL;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.use_stat_tables = 10;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.use_stat_tables = -1024;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.use_stat_tables = 2.4;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.use_stat_tables = OFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.use_stat_tables = 10;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.use_stat_tables = -2;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.use_stat_tables = 1.2;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.use_stat_tables = ON;
###############################################################################
# Check if the value in GLOBAL & SESSION Tables matches value in variable #
###############################################################################
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='use_stat_tables';
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='use_stat_tables';
####################################
# Restore initial value #
####################################
SET @@global.use_stat_tables = @start_global_value;
SELECT @@global.use_stat_tables;
SET @@session.use_stat_tables = @start_session_value;
SELECT @@session.use_stat_tables;
set sql_mode='';
######################################################
# END OF use_stat_tables TESTS #
######################################################
\ No newline at end of file
CREATE TABLE A (
pk INTEGER AUTO_INCREMENT PRIMARY KEY,
fdate DATE
) ENGINE=MyISAM;
--delimiter |
CREATE PROCEDURE p_analyze()
BEGIN
DECLARE attempts INTEGER DEFAULT 100;
wl_loop: WHILE attempts > 0 DO
ANALYZE TABLE A;
SET attempts = attempts - 1;
END WHILE wl_loop;
END |
CREATE FUNCTION rnd3() RETURNS INT
BEGIN
RETURN ROUND(3 * RAND() + 0.5);
END |
--delimiter ;
SET GLOBAL use_stat_tables = PREFERABLY;
--let $trial = 100
--disable_query_log
--disable_result_log
--disable_warnings
while ($trial)
{
--connect (con1,localhost,root,,)
--send CALL p_analyze()
--connect (con2,localhost,root,,)
--send CALL p_analyze()
--let $run = 100
while ($run)
{
--connect (con3,localhost,root,,)
let $query = `SELECT CASE rnd3()
WHEN 1 THEN 'INSERT INTO A (pk) VALUES (NULL)'
WHEN 2 THEN 'DELETE FROM A LIMIT 1'
ELSE 'UPDATE A SET fdate = 2 LIMIT 1' END`;
--eval $query
--disconnect con3
--dec $run
}
--connection con2
--reap
--disconnect con2
--connection con1
--reap
--disconnect con1
--dec $trial
}
--enable_query_log
--enable_result_log
--enable_warnings
# Cleanup
--connection default
DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
SET GLOBAL use_stat_tables = DEFAULT;
--source include/have_stat_tables.inc
select @@global.use_stat_tables;
select @@session.use_stat_tables;
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
--disable_warnings
DROP DATABASE IF EXISTS dbt3_s001;
--enable_warnings
CREATE DATABASE dbt3_s001;
use dbt3_s001;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
--disable_query_log
--disable_result_log
--disable_warnings
--source include/dbt3_s001.inc
create index i_p_retailprice on part(p_retailprice);
delete from mysql.table_stat;
delete from mysql.column_stat;
delete from mysql.index_stat;
ANALYZE TABLE
customer, lineitem, nation, orders, part, partsupp, region, supplier;
FLUSH TABLE mysql.table_stat, mysql.index_stat;
--enable_warnings
--enable_result_log
--enable_query_log
select * from mysql.table_stat;
select * from mysql.index_stat;
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='index_condition_pushdown=off';
let $Q5=
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
from customer, orders, lineitem, supplier, nation, region
where c_custkey = o_custkey and l_orderkey = o_orderkey
and l_suppkey = s_suppkey and c_nationkey = s_nationkey
and s_nationkey = n_nationkey and n_regionkey = r_regionkey
and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
and o_orderdate < date '1995-01-01' + interval '1' year
group by n_name
order by revenue desc;
eval EXPLAIN $Q5;
eval $Q5;
set optimizer_switch=@save_optimizer_switch;
delete from mysql.index_stat;
--disable_query_log
--disable_result_log
--disable_warnings
ANALYZE TABLE
customer, lineitem, nation, orders, part, partsupp, region, supplier;
FLUSH TABLE mysql.table_stat, mysql.index_stat;
--enable_warnings
--enable_result_log
--enable_query_log
select * from mysql.table_stat;
select * from mysql.index_stat;
select * from mysql.table_stat where table_name='orders';
select * from mysql.index_stat where table_name='orders';
select (select cardinality from mysql.table_stat where table_name='orders') /
(select avg_frequency from mysql.index_stat
where index_name='i_o_orderdate' and prefix_arity=1) as n_distinct;
select count(distinct o_orderdate) from orders;
select (select cardinality from mysql.table_stat where table_name='orders') /
(select avg_frequency from mysql.index_stat
where index_name='i_o_custkey' and prefix_arity=1) as n_distinct;
select count(distinct o_custkey) from orders;
show index from orders;
select index_name, column_name, cardinality from information_schema.statistics
where table_name='orders';
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='index_condition_pushdown=off';
eval EXPLAIN $Q5;
eval $Q5;
set optimizer_switch=@save_optimizer_switch;
let $Q8=
select o_year,
sum(case when nation = 'UNITED STATES' then volume else 0 end) /
sum(volume) as mkt_share
from (select extract(year from o_orderdate) as o_year,
l_extendedprice * (1-l_discount) as volume,
n2.n_name as nation
from part, supplier, lineitem, orders, customer,
nation n1, nation n2, region
where p_partkey = l_partkey and s_suppkey = l_suppkey
and l_orderkey = o_orderkey and o_custkey = c_custkey
and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey
and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey
and o_orderdate between date '1995-01-01' and date '1996-12-31'
and p_type = 'STANDARD BRUSHED STEEL' ) as all_nations
group by o_year
order by o_year;
eval EXPLAIN $Q8;
eval $Q8;
let $Q9=
select nation, o_year, sum(amount) as sum_profit
from (select n_name as nation,
extract(year from o_orderdate) as o_year,
l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount
from part, supplier, lineitem, partsupp, orders, nation
where s_suppkey = l_suppkey and ps_suppkey = l_suppkey
and ps_partkey = l_partkey and p_partkey = l_partkey
and o_orderkey = l_orderkey and s_nationkey = n_nationkey
and p_name like '%green%') as profit
group by nation, o_year
order by nation, o_year desc;
eval EXPLAIN $Q9;
eval $Q9;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
let $QQ1=
select o_orderkey, p_partkey
from part, lineitem, orders
where p_retailprice > 1100 and o_orderdate='1997-01-01'
and o_orderkey=l_orderkey and p_partkey=l_partkey;
eval EXPLAIN $QQ1;
eval $QQ1;
set optimizer_switch=@save_optimizer_switch;
DROP DATABASE dbt3_s001;
use test;
--echo #
--echo # Bug mdev-473: ANALYZE table locked for write
--echo #
set use_stat_tables='complementary';
create table t1 (i int);
lock table t1 write;
analyze table t1;
alter table t1 add column a varchar(8);
drop table t1;
--echo #
--echo # Bug mdev-487: memory leak in ANALYZE with stat tables
--echo #
SET use_stat_tables = 'preferably';
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
DELETE FROM t1 WHERE a=1;
ANALYZE TABLE t1;
DROP TABLE t1;
--echo #
--echo # Bug mdev-518: corrupted/missing statistical tables
--echo #
CREATE TABLE t1 (i int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
FLUSH TABLE t1;
SET use_stat_tables='never';
EXPLAIN SELECT * FROM t1;
--move_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/table_stat.MYD $MYSQLTEST_VARDIR/mysqld.1/data/mysql/table_stat.MYD.save
FLUSH TABLES;
SET use_stat_tables='preferably';
--disable_warnings
EXPLAIN SELECT * FROM t1;
--enable_warnings
# Cleanup
--move_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/table_stat.MYD.save $MYSQLTEST_VARDIR/mysqld.1/data/mysql/table_stat.MYD
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
--source include/have_innodb.inc
SET SESSION STORAGE_ENGINE='InnoDB';
select @@global.use_stat_tables;
select @@session.use_stat_tables;
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
--disable_warnings
DROP DATABASE IF EXISTS dbt3_s001;
--enable_warnings
CREATE DATABASE dbt3_s001;
use dbt3_s001;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
--disable_query_log
--disable_result_log
--disable_warnings
--source include/dbt3_s001.inc
delete from mysql.table_stat;
delete from mysql.column_stat;
delete from mysql.index_stat;
ANALYZE TABLE
customer, lineitem, nation, orders, part, partsupp, region, supplier;
--enable_warnings
--enable_result_log
--enable_query_log
--echo #
--echo # Bug mdev-503: optimizer ignores setting use_stat_tables='preferably'
--echo #
flush tables
customer, lineitem, nation, orders, part, partsupp, region, supplier;
let $Q3S=
select sql_calc_found_rows straight_join
l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue,
o_orderdate, o_shippriority
from orders, customer, lineitem
where c_mktsegment = 'BUILDING' and c_custkey = o_custkey
and l_orderkey = o_orderkey and o_orderdate < date '1995-03-15'
and l_shipdate > date '1995-03-15'
group by l_orderkey, o_orderdate, o_shippriority
order by revenue desc, o_orderdate
limit 10;
set use_stat_tables='never';
--replace_column 9 #
eval EXPLAIN $Q3S;
set use_stat_tables='preferably';
--replace_result 2 1
eval EXPLAIN $Q3S;
flush tables customer, orders, lineitem;
eval EXPLAIN $Q3S;
--echo # End of the test case for mdev-503
set optimizer_switch=@save_optimizer_switch;
DROP DATABASE dbt3_s001;
use test;
set use_stat_tables=@save_use_stat_tables;
SET SESSION STORAGE_ENGINE=DEFAULT;
--source include/have_innodb.inc
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
--source stat_tables.test
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
--source include/have_stat_tables.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
--disable_warnings
DROP DATABASE IF EXISTS dbt3_s001;
--enable_warnings
CREATE DATABASE dbt3_s001;
use dbt3_s001;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
--disable_query_log
--disable_result_log
--disable_warnings
--source include/dbt3_s001.inc
delete from mysql.table_stat;
delete from mysql.column_stat;
delete from mysql.index_stat;
ANALYZE TABLE
customer, lineitem, nation, orders, part, partsupp, region, supplier;
--enable_warnings
--enable_result_log
--enable_query_log
select * from mysql.table_stat;
select * from mysql.index_stat;
#
# Test for parallel memory allocation for statistical data
#
# assumes that start the code of memory allocation for stats data has this line:
#
# DEBUG_SYNC(thd, "statistics_mem_alloc_start1");
# DEBUG_SYNC(thd, "statistics_mem_alloc_start2");
#
let $Q6=
select sum(l_extendedprice*l_discount) as revenue
from lineitem
where l_shipdate >= date '1994-01-01'
and l_shipdate < date '1994-01-01' + interval '1' year
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
flush table lineitem;
set use_stat_tables='never';
eval $Q6;
connect (con1, localhost, root,,);
connect (con2, localhost, root,,);
connection con1;
set debug_sync='statistics_mem_alloc_start1 WAIT_FOR second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2 SIGNAL first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
--send_eval $Q6
connection con2;
set debug_sync='statistics_mem_alloc_start1 SIGNAL second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2 WAIT_FOR first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
--send_eval $Q6
connection con1;
--reap
connection con2;
--reap
connection default;
set use_stat_tables='preferably';
disconnect con1;
disconnect con2;
set debug_sync='RESET';
#
# Test for parallel statistics collection
#
# assumes that start of stats collection code has this line:
#
# DEBUG_SYNC(thd, "statistics_collection_start1");
# DEBUG_SYNC(thd, "statistics_collection_start2");
#
select * from mysql.index_stat where table_name='lineitem' order by index_name;
delete from mysql.index_stat
where table_name='lineitem' and
index_name in ('i_l_shipdate', 'i_l_receiptdate');
select * from mysql.index_stat where table_name='lineitem' order by index_name;
--disable_result_log
--disable_warnings
analyze table lineitem persistent for columns() indexes (i_l_shipdate);
--enable_warnings
--enable_result_log
select * from mysql.index_stat where table_name='lineitem' order by index_name;
delete from mysql.index_stat
where table_name='lineitem' and index_name= 'i_l_shipdate';
select * from mysql.index_stat where table_name='lineitem' order by index_name;
connect (con1, localhost, root,,);
connect (con2, localhost, root,,);
connection con1;
set debug_sync='statistics_collection_start1 WAIT_FOR second_thread_started_too';
set debug_sync='statistics_collection_start2 SIGNAL first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
--send analyze table lineitem persistent for columns() indexes (i_l_shipdate)
connection con2;
set debug_sync='statistics_collection_start1 SIGNAL second_thread_started_too';
set debug_sync='statistics_collection_start2 WAIT_FOR first_thread_working';
use dbt3_s001;
set use_stat_tables='preferably';
--send analyze table lineitem persistent for columns() indexes (i_l_receiptdate)
connection con1;
--disable_result_log
--disable_warnings
--reap
--enable_warnings
--enable_result_log
connection con2;
--disable_result_log
--disable_warnings
--reap
--enable_warnings
--enable_result_log
connection default;
disconnect con1;
disconnect con2;
set debug_sync='RESET';
select * from mysql.index_stat where table_name='lineitem' order by index_name;
DROP DATABASE dbt3_s001;
use test;
set use_stat_tables=@save_use_stat_tables;
--source include/have_innodb.inc
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
--source stat_tables_par.test
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
--source include/have_partition.inc
--echo #
--echo # Bug mdev-463: assertion failure when running ANALYZE with RBR on
--echo #
SET GLOBAL use_stat_tables = PREFERABLY;
--connect (con1,localhost,root,,)
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
ANALYZE TABLE t1;
# Cleanup
DROP TABLE t1;
SET GLOBAL use_stat_tables = DEFAULT;
--disconnect con1
--connection default
SET use_stat_tables = PREFERABLY;
CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2;
ALTER TABLE t1 ANALYZE PARTITION p1;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS;
SET use_stat_tables = DEFAULT;
DROP TABLE t1;
--source include/have_stat_tables.inc
--source include/master-slave.inc
--source include/have_binlog_format_row.inc
--echo #
--echo # Bug mdev-485: unexpected failure with replication of DROP/ALTER table
--echo # when RBR is on
--echo #
CREATE TABLE t1 ( a int, b int ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
DROP TABLE t1;
--sync_slave_with_master
--connection master
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
DROP INDEX idx1 ON t1;
--sync_slave_with_master
--connection master
DROP TABLE t1;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
ALTER TABLE t1 DROP COLUMN b;
--sync_slave_with_master
--connection master
DROP TABLE t1;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
ALTER TABLE t1 RENAME to s;
--sync_slave_with_master
--connection master
DROP TABLE s;
CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
ANALYZE TABLE t1;
ALTER TABLE t1 CHANGE COLUMN b c int ;
--sync_slave_with_master
--connection master
DROP TABLE t1;
--source include/rpl_end.inc
This diff is collapsed.
......@@ -59,6 +59,11 @@ CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL,
CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
CREATE TABLE table_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables';
CREATE TABLE column_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varchar(255) DEFAULT NULL, max_value varchar(255) DEFAULT NULL, nulls_ratio double DEFAULT NULL, avg_length double DEFAULT NULL, avg_frequency double DEFAULT NULL, PRIMARY KEY (db_name,table_name,column_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';
CREATE TABLE index_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, index_name varchar(64) NOT NULL, prefix_arity int(11) unsigned NOT NULL, avg_frequency double DEFAULT NULL, PRIMARY KEY (db_name,table_name,index_name,prefix_arity) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Indexes';
# Run the mysql_fix_privilege_tables.sql using "mysql --force"
--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES
......@@ -72,7 +77,7 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL,
-- disable_query_log
# Drop all tables created by this test
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv;
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stat, column_stat, index_stat;
-- enable_query_log
......
......@@ -66,6 +66,12 @@ CREATE TABLE servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) N
INSERT INTO servers VALUES ('test','localhost','test','root','', 0,'','mysql','root');
CREATE TABLE table_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables';
CREATE TABLE column_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varchar(255) DEFAULT NULL, max_value varchar(255) DEFAULT NULL, nulls_ratio double DEFAULT NULL, avg_length double DEFAULT NULL, avg_frequency double DEFAULT NULL, PRIMARY KEY (db_name,table_name,column_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';
CREATE TABLE index_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, index_name varchar(64) NOT NULL, prefix_arity int(11) unsigned NOT NULL, avg_frequency double DEFAULT NULL, PRIMARY KEY (db_name,table_name,index_name,prefix_arity) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Indexes';
# Run the mysql_fix_privilege_tables.sql using "mysql --force"
--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES
......@@ -78,7 +84,7 @@ INSERT INTO servers VALUES ('test','localhost','test','root','', 0,'','mysql','r
-- disable_query_log
# Drop all tables created by this test
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv;
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stat, column_stat, index_stat;
-- enable_query_log
......
......@@ -85,6 +85,12 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
CREATE TABLE table_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables';
CREATE TABLE column_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varchar(255) DEFAULT NULL, max_value varchar(255) DEFAULT NULL, nulls_ratio double DEFAULT NULL, avg_length double DEFAULT NULL, avg_frequency double DEFAULT NULL, PRIMARY KEY (db_name,table_name,column_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';
CREATE TABLE index_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, index_name varchar(64) NOT NULL, prefix_arity int(11) unsigned NOT NULL, avg_frequency double DEFAULT NULL, PRIMARY KEY (db_name,table_name,index_name,prefix_arity) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Indexes';
# Run the mysql_fix_privilege_tables.sql using "mysql --force"
--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES
......@@ -97,7 +103,7 @@ CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL,
-- disable_query_log
# Drop all tables created by this test
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv;
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stat, column_stat, index_stat;
-- enable_query_log
......
......@@ -482,3 +482,9 @@ CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NUL
-- Remember for later if proxies_priv table already existed
set @had_proxies_priv_table= @@warning_count != 0;
CREATE TABLE IF NOT EXISTS table_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables';
CREATE TABLE IF NOT EXISTS column_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varchar(255) DEFAULT NULL, max_value varchar(255) DEFAULT NULL, nulls_ratio decimal(12,4) DEFAULT NULL, avg_length decimal(12,4) DEFAULT NULL, avg_frequency decimal(12,4) DEFAULT NULL, PRIMARY KEY (db_name,table_name,column_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';
CREATE TABLE IF NOT EXISTS index_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, index_name varchar(64) NOT NULL, prefix_arity int(11) unsigned NOT NULL, avg_frequency decimal(12,4) DEFAULT NULL, PRIMARY KEY (db_name,table_name,index_name,prefix_arity) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Indexes';
......@@ -62,7 +62,8 @@ SET (SQL_SOURCE
sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc
sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
debug_sync.cc debug_sync.h
sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc
sql_repl.cc sql_select.cc sql_show.cc sql_state.c
sql_statistics.cc sql_string.cc
sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc
sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc
sql_time.cc tztime.cc uniques.cc unireg.cc item_xmlfunc.cc
......
This diff is collapsed.
......@@ -36,6 +36,8 @@ class Protocol;
class Create_field;
class Relay_log_info;
class Field;
class Column_statistics;
class Column_statistics_collected;
enum enum_check_fields
{
......@@ -66,6 +68,8 @@ enum Derivation
/* The length of the header part for each virtual column in the .frm file */
#define FRM_VCOL_HEADER_SIZE(b) (3 + test(b))
class Count_distinct_field;
struct ha_field_option_struct;
struct st_cache_field;
......@@ -216,6 +220,19 @@ class Field
*/
bool is_created_from_null_item;
bool is_stat_field; /* TRUE in Field objects created for column min/max values */
/*
This structure is used for statistical data on the column
that has been read from the statistical table column_stat
*/
Column_statistics *read_stats;
/*
This structure is used for statistical data on the column that
is collected by the function collect_statistics_for_table
*/
Column_statistics_collected *collected_stats;
/*
This is additional data provided for any computed(virtual) field.
In particular it includes a pointer to the item by which this field
......@@ -308,6 +325,26 @@ class Field
virtual uint32 data_length() { return pack_length(); }
virtual uint32 sort_length() const { return pack_length(); }
/*
Get the number bytes occupied by the value in the field.
CHAR values are stripped of trailing spaces.
Flexible values are stripped of their length.
*/
virtual uint32 value_length()
{
uint len;
if (!zero_pack() &&
(type() == MYSQL_TYPE_STRING &&
(len= pack_length()) >= 4 && len < 256))
{
uchar *str, *end;
for (str= ptr, end= str+len; end > str && end[-1] == ' '; end--) {}
len=(uint) (end-str);
return len;
}
return data_length();
}
/**
Get the maximum size of the data in packed format.
......@@ -349,6 +386,36 @@ class Field
{ return cmp(a, b); }
virtual int key_cmp(const uchar *str, uint length)
{ return cmp(ptr,str); }
/*
Update the value m of the 'min_val' field with the current value v
of this field if force_update is set to TRUE or if v < m.
Return TRUE if the value has been updated.
*/
virtual bool update_min(Field *min_val, bool force_update)
{
bool update_fl= force_update || cmp(ptr, min_val->ptr) < 0;
if (update_fl)
{
min_val->set_notnull();
memcpy(min_val->ptr, ptr, pack_length());
}
return update_fl;
}
/*
Update the value m of the 'max_val' field with the current value v
of this field if force_update is set to TRUE or if v > m.
Return TRUE if the value has been updated.
*/
virtual bool update_max(Field *max_val, bool force_update)
{
bool update_fl= force_update || cmp(ptr, max_val->ptr) > 0;
if (update_fl)
{
max_val->set_notnull();
memcpy(max_val->ptr, ptr, pack_length());
}
return update_fl;
}
virtual uint decimals() const { return 0; }
/*
Caller beware: sql_type can change str.Ptr, so check
......@@ -384,6 +451,8 @@ class Field
*/
inline bool real_maybe_null(void) { return null_ptr != 0; }
inline THD *get_thd() { return table ? table->in_use : current_thd; }
enum {
LAST_NULL_BYTE_UNDEF= 0
};
......@@ -420,6 +489,9 @@ class Field
uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit);
Field *clone(MEM_ROOT *mem_root, TABLE *new_table);
Field *clone(MEM_ROOT *mem_root, TABLE *new_table, my_ptrdiff_t diff,
bool stat_flag= FALSE);
Field *clone(MEM_ROOT *mem_root, my_ptrdiff_t diff);
inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg)
{
ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg;
......@@ -1811,6 +1883,10 @@ class Field_blob :public Field_longstr {
int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L);
int key_cmp(const uchar *,const uchar*);
int key_cmp(const uchar *str, uint length);
/* Never update the value of min_val for a blob field */
bool update_min(Field *min_val, bool force_update) { return FALSE; }
/* Never update the value of max_val for a blob field */
bool update_max(Field *max_val, bool force_update) { return FALSE; }
uint32 key_length() const { return 0; }
void sort_string(uchar *buff,uint length);
uint32 pack_length() const
......@@ -1828,6 +1904,7 @@ class Field_blob :public Field_longstr {
{ return (uint32) (packlength); }
uint row_pack_length() { return pack_length_no_ptr(); }
uint32 sort_length() const;
uint32 value_length() { return get_length(); }
virtual uint32 max_data_length() const
{
return (uint32) (((ulonglong) 1 << (packlength*8)) -1);
......@@ -2099,6 +2176,28 @@ class Field_bit :public Field {
{ return cmp_binary((uchar *) a, (uchar *) b); }
int key_cmp(const uchar *str, uint length);
int cmp_offset(uint row_offset);
bool update_min(Field *min_val, bool force_update)
{
longlong val= val_int();
bool update_fl= force_update || val < min_val->val_int();
if (update_fl)
{
min_val->set_notnull();
min_val->store(val, FALSE);
}
return update_fl;
}
bool update_max(Field *max_val, bool force_update)
{
longlong val= val_int();
bool update_fl= force_update || val > max_val->val_int();
if (update_fl)
{
max_val->set_notnull();
max_val->store(val, FALSE);
}
return update_fl;
}
void get_image(uchar *buff, uint length, CHARSET_INFO *cs)
{ get_key_image(buff, length, itRAW); }
void set_image(const uchar *buff,uint length, CHARSET_INFO *cs)
......
This diff is collapsed.
......@@ -1201,7 +1201,7 @@ bool DsMrr_impl::setup_buffer_sharing(uint key_size_in_keybuf,
uint parts= my_count_bits(key_tuple_map);
ulong rpc;
ulonglong rowids_size= rowid_buf_elem_size;
if ((rpc= key_info->rec_per_key[parts - 1]))
if ((rpc= key_info->real_rec_per_key(parts - 1)))
rowids_size= rowid_buf_elem_size * rpc;
double fraction_for_rowids=
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -502,6 +502,7 @@ typedef struct system_variables
ulong net_write_timeout;
ulong optimizer_prune_level;
ulong optimizer_search_depth;
ulong use_stat_tables;
ulong preload_buff_size;
ulong profiling_history_size;
ulong read_buff_size;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment