Commit f549f495 authored by Igor Babaev's avatar Igor Babaev

Removed the server option --stat-tables.

Renamed the system variable optimizer_use_stat_tables to use_stat_tables.
This variable now has only 3 possible values:
'never', 'complementary', 'preferably'.
If the server has been launched with
--use-stat-tables='complementary'|'preferably'
then the statictics tables can be employed by the optimizer and by the
ANALYZE command. 
parent 2ee14ef9
--stat-tables
--use-stat-tables='complementary'
......@@ -493,9 +493,6 @@ The following options may be given as the first argument:
partial_match_table_scan, semijoin, semijoin_with_cache,
subquery_cache, table_elimination, extended_keys } and
val is one of {on, off, default}
--optimizer-use-stat-tables=name
Specifies how to use system statistics tables. Possible
values are NEVER, COMPLEMENTARY, PREVERABLY, EXCLUSIVELY
--performance-schema
Enable the performance schema.
--performance-schema-events-waits-history-long-size=#
......@@ -778,9 +775,6 @@ The following options may be given as the first argument:
for the complete list of valid sql modes
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
--stat-tables Start with statistical tables. Statistical data on table
cardinalities, columns and indexes from these tables
become available
--stored-program-cache=#
The soft upper limit for number of cached stored routines
for one connection.
......@@ -838,6 +832,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
......@@ -996,7 +993,6 @@ old-style-user-limits FALSE
optimizer-prune-level 1
optimizer-search-depth 62
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
optimizer-use-stat-tables NEVER
performance-schema FALSE
performance-schema-events-waits-history-long-size 10000
performance-schema-events-waits-history-size 10
......@@ -1069,7 +1065,6 @@ slow-query-log FALSE
sort-buffer-size 2097152
sql-mode
stack-trace TRUE
stat-tables FALSE
stored-program-cache 256
symbolic-links FALSE
sync-binlog 0
......@@ -1091,6 +1086,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
......
set @save_optimizer_use_stat_tables=@@optimizer_use_stat_tables;
set optimizer_use_stat_tables='preferably';
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;
......@@ -336,4 +336,4 @@ o_orderkey p_partkey
set optimizer_switch=@save_optimizer_switch;
DROP DATABASE dbt3_s001;
use test;
set optimizer_use_stat_tables=@save_optimizer_use_stat_tables;
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_optimizer_use_stat_tables=@@optimizer_use_stat_tables;
set optimizer_use_stat_tables='preferably';
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;
......@@ -363,6 +363,6 @@ o_orderkey p_partkey
set optimizer_switch=@save_optimizer_switch;
DROP DATABASE dbt3_s001;
use test;
set optimizer_use_stat_tables=@save_optimizer_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
drop table if exists t1,t2;
set @save_optimizer_use_stat_tables=@@optimizer_use_stat_tables;
set @save_use_stat_tables=@@use_stat_tables;
CREATE VIEW table_stat AS
SELECT * FROM mysql.table_stat;
CREATE VIEW column_stat AS
......@@ -16,7 +16,7 @@ CAST(avg_frequency AS decimal(12,4)) AS 'avg_frequency'
DELETE FROM mysql.table_stat;
DELETE FROM mysql.column_stat;
DELETE FROM mysql.index_stat;
set optimizer_use_stat_tables='preferably';
set use_stat_tables='preferably';
CREATE TABLE t1 (
a int NOT NULL PRIMARY KEY,
b varchar(32),
......@@ -358,7 +358,7 @@ DROP TABLE t1,t2;
DELETE FROM mysql.table_stat;
DELETE FROM mysql.column_stat;
DELETE FROM mysql.index_stat;
set optimizer_use_stat_tables='never';
set use_stat_tables='never';
set names utf8;
CREATE DATABASE world;
use world;
......@@ -387,7 +387,7 @@ Percentage float(3,1) NOT NULL default '0.0',
PRIMARY KEY (Country, Language),
INDEX (Percentage)
) CHARACTER SET utf8 COLLATE utf8_bin;
set optimizer_use_stat_tables='preferably';
set use_stat_tables='preferably';
ANALYZE TABLE Country, City, CountryLanguage;
SELECT UPPER(db_name), UPPER(table_name), cardinality
FROM test.table_stat;
......@@ -424,7 +424,7 @@ WORLD COUNTRYLANGUAGE PRIMARY 1 4.2232
WORLD COUNTRYLANGUAGE PRIMARY 2 1.0000
WORLD COUNTRYLANGUAGE Percentage 1 2.7640
use test;
set optimizer_use_stat_tables='never';
set use_stat_tables='never';
CREATE DATABASE world_innodb;
use world_innodb;
CREATE TABLE Country (
......@@ -455,7 +455,7 @@ INDEX (Percentage)
ALTER TABLE Country ENGINE=InnoDB;
ALTER TABLE City ENGINE=InnoDB;
ALTER TABLE CountryLanguage ENGINE=InnoDB;
set optimizer_use_stat_tables='preferably';
set use_stat_tables='preferably';
ANALYZE TABLE Country, City, CountryLanguage;
SELECT UPPER(db_name), UPPER(table_name), cardinality
FROM test.table_stat;
......@@ -523,4 +523,4 @@ DELETE FROM mysql.index_stat;
DROP VIEW test.table_stat;
DROP VIEW test.column_stat;
DROP VIEW test.index_stat;
set optimizer_use_stat_tables=@save_optimizer_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
SET @start_global_value = @@global.optimizer_use_stat_tables;
SELECT @start_global_value;
@start_global_value
NEVER
SET @start_session_value = @@session.optimizer_use_stat_tables;
SELECT @start_session_value;
@start_session_value
NEVER
SET @@global.optimizer_use_stat_tables = 2;
SET @@global.optimizer_use_stat_tables = DEFAULT;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
NEVER
SET @@session.optimizer_use_stat_tables = 3;
SET @@session.optimizer_use_stat_tables = DEFAULT;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
NEVER
SET @@global.optimizer_use_stat_tables = 0;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
NEVER
SET @@global.optimizer_use_stat_tables = 1;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
COMPLEMENTARY
SET @@global.optimizer_use_stat_tables = 2;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
PREFERABLY
SET @@global.optimizer_use_stat_tables = 3;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
EXCLUSIVELY
SET @@global.optimizer_use_stat_tables = NEVER;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
NEVER
SET @@global.optimizer_use_stat_tables = COMPLEMENTARY;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
COMPLEMENTARY
SET @@global.optimizer_use_stat_tables = PREFERABLY;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
PREFERABLY
SET @@global.optimizer_use_stat_tables = EXCLUSIVELY;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
EXCLUSIVELY
SET @@session.optimizer_use_stat_tables = 0;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
NEVER
SET @@session.optimizer_use_stat_tables = 1;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
COMPLEMENTARY
SET @@session.optimizer_use_stat_tables = 2;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
PREFERABLY
SET @@session.optimizer_use_stat_tables = 3;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
EXCLUSIVELY
SET @@session.optimizer_use_stat_tables = NEVER;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
NEVER
SET @@session.optimizer_use_stat_tables = PREFERABLY;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
PREFERABLY
SET @@session.optimizer_use_stat_tables = EXCLUSIVELY;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
EXCLUSIVELY
SET @@session.optimizer_use_stat_tables = COMPLEMENTARY;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
COMPLEMENTARY
set sql_mode=TRADITIONAL;
SET @@global.optimizer_use_stat_tables = 10;
ERROR 42000: Variable 'optimizer_use_stat_tables' can't be set to the value of '10'
SET @@global.optimizer_use_stat_tables = -1024;
ERROR 42000: Variable 'optimizer_use_stat_tables' can't be set to the value of '-1024'
SET @@global.optimizer_use_stat_tables = 2.4;
ERROR 42000: Incorrect argument type to variable 'optimizer_use_stat_tables'
SET @@global.optimizer_use_stat_tables = OFF;
ERROR 42000: Variable 'optimizer_use_stat_tables' can't be set to the value of 'OFF'
SET @@session.optimizer_use_stat_tables = 10;
ERROR 42000: Variable 'optimizer_use_stat_tables' can't be set to the value of '10'
SET @@session.optimizer_use_stat_tables = -2;
ERROR 42000: Variable 'optimizer_use_stat_tables' can't be set to the value of '-2'
SET @@session.optimizer_use_stat_tables = 1.2;
ERROR 42000: Incorrect argument type to variable 'optimizer_use_stat_tables'
SET @@session.optimizer_use_stat_tables = ON;
ERROR 42000: Variable 'optimizer_use_stat_tables' can't be set to the value of 'ON'
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='optimizer_use_stat_tables';
VARIABLE_NAME VARIABLE_VALUE
OPTIMIZER_USE_STAT_TABLES EXCLUSIVELY
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='optimizer_use_stat_tables';
VARIABLE_NAME VARIABLE_VALUE
OPTIMIZER_USE_STAT_TABLES COMPLEMENTARY
SET @@global.optimizer_use_stat_tables = @start_global_value;
SELECT @@global.optimizer_use_stat_tables;
@@global.optimizer_use_stat_tables
NEVER
SET @@session.optimizer_use_stat_tables = @start_session_value;
SELECT @@session.optimizer_use_stat_tables;
@@session.optimizer_use_stat_tables
NEVER
set sql_mode='';
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='';
......@@ -4,109 +4,97 @@
# Save initial value #
#############################################################
SET @start_global_value = @@global.optimizer_use_stat_tables;
SET @start_global_value = @@global.use_stat_tables;
SELECT @start_global_value;
SET @start_session_value = @@session.optimizer_use_stat_tables;
SET @start_session_value = @@session.use_stat_tables;
SELECT @start_session_value;
###############################################################
# Display the DEFAULT value of optimizer_use_stat_tables #
# Display the DEFAULT value of use_stat_tables #
###############################################################
SET @@global.optimizer_use_stat_tables = 2;
SET @@global.optimizer_use_stat_tables = DEFAULT;
SELECT @@global.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = 3;
SET @@session.optimizer_use_stat_tables = DEFAULT;
SELECT @@session.optimizer_use_stat_tables;
SET @@global.use_stat_tables = 2;
SET @@global.use_stat_tables = DEFAULT;
SELECT @@global.use_stat_tables;
##################################################################################
# Change the value ofoptimizer_use_stat_tables to a valid value for GLOBAL Scope #
# Change the value of use_stat_tables to a valid value for GLOBAL Scope #
##################################################################################
SET @@global.optimizer_use_stat_tables = 0;
SELECT @@global.optimizer_use_stat_tables;
SET @@global.optimizer_use_stat_tables = 1;
SELECT @@global.optimizer_use_stat_tables;
SET @@global.optimizer_use_stat_tables = 2;
SELECT @@global.optimizer_use_stat_tables;
SET @@global.optimizer_use_stat_tables = 3;
SELECT @@global.optimizer_use_stat_tables;
SET @@global.optimizer_use_stat_tables = NEVER;
SELECT @@global.optimizer_use_stat_tables;
SET @@global.optimizer_use_stat_tables = COMPLEMENTARY;
SELECT @@global.optimizer_use_stat_tables;
SET @@global.optimizer_use_stat_tables = PREFERABLY;
SELECT @@global.optimizer_use_stat_tables;
SET @@global.optimizer_use_stat_tables = EXCLUSIVELY;
SELECT @@global.optimizer_use_stat_tables;
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 optimizer_use_stat_tables to a valid value for SESSION Scope #
# Change the value of use_stat_tables to a valid value for SESSION Scope #
####################################################################################
SET @@session.optimizer_use_stat_tables = 0;
SELECT @@session.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = 1;
SELECT @@session.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = 2;
SELECT @@session.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = 3;
SELECT @@session.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = NEVER;
SELECT @@session.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = PREFERABLY;
SELECT @@session.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = EXCLUSIVELY;
SELECT @@session.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = COMPLEMENTARY;
SELECT @@session.optimizer_use_stat_tables;
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 optimizer_use_stat_tables to an invalid value #
# Change the value of use_stat_tables to an invalid value #
#####################################################################
set sql_mode=TRADITIONAL;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.optimizer_use_stat_tables = 10;
SET @@global.use_stat_tables = 10;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.optimizer_use_stat_tables = -1024;
SET @@global.use_stat_tables = -1024;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.optimizer_use_stat_tables = 2.4;
SET @@global.use_stat_tables = 2.4;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.optimizer_use_stat_tables = OFF;
SET @@global.use_stat_tables = OFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.optimizer_use_stat_tables = 10;
SET @@session.use_stat_tables = 10;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.optimizer_use_stat_tables = -2;
SET @@session.use_stat_tables = -2;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.optimizer_use_stat_tables = 1.2;
SET @@session.use_stat_tables = 1.2;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.optimizer_use_stat_tables = ON;
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='optimizer_use_stat_tables';
WHERE VARIABLE_NAME='use_stat_tables';
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='optimizer_use_stat_tables';
WHERE VARIABLE_NAME='use_stat_tables';
####################################
# Restore initial value #
####################################
SET @@global.optimizer_use_stat_tables = @start_global_value;
SELECT @@global.optimizer_use_stat_tables;
SET @@session.optimizer_use_stat_tables = @start_session_value;
SELECT @@session.optimizer_use_stat_tables;
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 optimizer_use_stat_tables TESTS #
# END OF use_stat_tables TESTS #
######################################################
\ No newline at end of file
--source include/have_stat_tables.inc
set @save_optimizer_use_stat_tables=@@optimizer_use_stat_tables;
set @save_use_stat_tables=@@use_stat_tables;
set optimizer_use_stat_tables='preferably';
set use_stat_tables='preferably';
--disable_warnings
DROP DATABASE IF EXISTS dbt3_s001;
......@@ -149,4 +149,4 @@ DROP DATABASE dbt3_s001;
use test;
set optimizer_use_stat_tables=@save_optimizer_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
......@@ -4,7 +4,7 @@
drop table if exists t1,t2;
--enable_warnings
set @save_optimizer_use_stat_tables=@@optimizer_use_stat_tables;
set @save_use_stat_tables=@@use_stat_tables;
CREATE VIEW table_stat AS
SELECT * FROM mysql.table_stat;
......@@ -26,7 +26,7 @@ DELETE FROM mysql.table_stat;
DELETE FROM mysql.column_stat;
DELETE FROM mysql.index_stat;
set optimizer_use_stat_tables='preferably';
set use_stat_tables='preferably';
CREATE TABLE t1 (
a int NOT NULL PRIMARY KEY,
......@@ -240,7 +240,7 @@ DELETE FROM mysql.table_stat;
DELETE FROM mysql.column_stat;
DELETE FROM mysql.index_stat;
set optimizer_use_stat_tables='never';
set use_stat_tables='never';
set names utf8;
......@@ -258,7 +258,7 @@ use world;
--enable_result_log
--enable_query_log
set optimizer_use_stat_tables='preferably';
set use_stat_tables='preferably';
--disable_result_log
ANALYZE TABLE Country, City, CountryLanguage;
......@@ -275,7 +275,7 @@ SELECT UPPER(db_name), UPPER(table_name),
use test;
set optimizer_use_stat_tables='never';
set use_stat_tables='never';
CREATE DATABASE world_innodb;
......@@ -295,7 +295,7 @@ ALTER TABLE CountryLanguage ENGINE=InnoDB;
--enable_result_log
--enable_query_log
set optimizer_use_stat_tables='preferably';
set use_stat_tables='preferably';
--disable_result_log
ANALYZE TABLE Country, City, CountryLanguage;
......@@ -323,6 +323,6 @@ DROP VIEW test.table_stat;
DROP VIEW test.column_stat;
DROP VIEW test.index_stat;
set optimizer_use_stat_tables=@save_optimizer_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
\ No newline at end of file
......@@ -446,7 +446,6 @@ ulong opt_replicate_events_marked_for_skip;
*/
volatile bool mqh_used = 0;
my_bool opt_noacl;
my_bool opt_with_stat_tables;
my_bool sp_automatic_privileges= 1;
ulong opt_binlog_rows_event_max_size;
......@@ -3743,7 +3742,7 @@ static int init_common_variables()
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
global_system_variables.optimizer_use_stat_tables= 0;
global_system_variables.use_stat_tables= 0;
if (!(character_set_filesystem=
get_charset_by_csname(character_set_filesystem_name,
......@@ -6387,11 +6386,6 @@ struct my_option my_long_options[]=
&opt_noacl, &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#endif
{"stat-tables", OPT_WITH_STAT_TABLES,
"Start with statistical tables. Statistical data on table cardinalities, "
"columns and indexes from these tables become available",
&opt_with_stat_tables, &opt_with_stat_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-slave-start", 0,
......@@ -7659,7 +7653,6 @@ mysqld_get_one_option(int optid,
break;
case OPT_BOOTSTRAP:
opt_noacl=opt_bootstrap=1;
opt_with_stat_tables= 0;
break;
case OPT_SERVER_ID:
server_id_supplied = 1;
......
......@@ -105,7 +105,7 @@ extern char* opt_secure_backup_file_priv;
extern size_t opt_secure_backup_file_priv_len;
extern my_bool opt_log_slow_admin_statements, opt_log_slow_slave_statements;
extern my_bool sp_automatic_privileges, opt_noacl;
extern my_bool opt_with_stat_tables;
extern ulong use_stat_tables;
extern my_bool opt_old_style_user_limits, trust_function_creators;
extern uint opt_crash_binlog_innodb;
extern char *shared_memory_base_name, *mysqld_unix_port;
......@@ -396,7 +396,6 @@ enum options_mysqld
OPT_SKIP_PRIOR,
OPT_SKIP_RESOLVE,
OPT_SKIP_STACK_TRACE,
OPT_WITH_STAT_TABLES,
OPT_SKIP_SYMLINKS,
OPT_SLOW_QUERY_LOG,
OPT_SSL_CA,
......
......@@ -700,9 +700,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
}
if (result_code == HA_ADMIN_OK &&
(operator_func != &handler::ha_analyze ||
thd->variables.optimizer_use_stat_tables < 3))
if (result_code == HA_ADMIN_OK)
{
DBUG_PRINT("admin", ("calling operator_func '%s'", operator_name));
result_code = (table->table->file->*operator_func)(thd, check_opt);
......@@ -710,8 +708,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
if (compl_result_code == HA_ADMIN_OK &&
operator_func == &handler::ha_analyze && opt_with_stat_tables &&
thd->variables.optimizer_use_stat_tables > 0)
operator_func == &handler::ha_analyze &&
thd->variables.use_stat_tables > 0)
{
if (!(compl_result_code=
collect_statistics_for_table(thd, table->table)))
......
......@@ -4631,7 +4631,7 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
goto end;
}
if (opt_with_stat_tables && thd->variables.optimizer_use_stat_tables > 0)
if (thd->variables.use_stat_tables > 0)
{
if (tables->table && tables->table->s &&
tables->table->s->table_category != TABLE_CATEGORY_SYSTEM)
......
......@@ -501,7 +501,7 @@ typedef struct system_variables
ulong net_write_timeout;
ulong optimizer_prune_level;
ulong optimizer_search_depth;
ulong optimizer_use_stat_tables;
ulong use_stat_tables;
ulong preload_buff_size;
ulong profiling_history_size;
ulong read_buff_size;
......
......@@ -28,13 +28,13 @@
#include "sql_statistics.h"
/*
The system variable 'optimizer_use_stat_tables' can take one of the
The system variable 'use_stat_tables' can take one of the
following values:
"never", "complementary", "preferably", "exclusively".
If the values of the variable 'optimizer_use_stat_tables' is set to
"never", "complementary", "preferably".
If the values of the variable 'use_stat_tables' is set to
"never then any statistical data from the persistent statistical tables
is ignored by the optimizer.
If the value of the variable 'optimizer_use_stat_tables' is set to
If the value of the variable 'use_stat_tables' is set to
"complementary" then a particular statistical characteristic is used
by the optimizer only if the database engine does not provide similar
statistics. For example, 'nulls_ratio' for table columns currently
......@@ -43,17 +43,13 @@
'avg_frequency' for any index prefix from the statistical tables since
the a similar statistical characteristic 'records_per_key' can be
requested from the database engine.
If the value the variable 'optimizer_use_stat_tables' is set to
If the value the variable 'use_stat_tables' is set to
"preferably" the optimizer uses a particular statistical data only if
it can't be found in the statistical data.
If the value of the variable 'optimizer_use_stat_tables' is set to
"exclusively" the optimizer never uses statistical data that can be
returned by the database engine Only statistical data from the
statistical tables is used.
If an ANALYZE command is executed then it results in collecting
statistical data for the tables specified by the command and storing
the collected statistics in the persistent statistical tables only
when the value of the variable 'optimizer_use_stat_tables' is not
when the value of the variable 'use_stat_tables' is not
equal to "never".
*/
......@@ -1650,14 +1646,14 @@ int read_statistics_for_table(THD *thd, TABLE *table)
table The table to set statistics for
@details
Depending on the value of thd->variables.optimizer_use_stat_tables
Depending on the value of thd->variables.use_stat_tables
the function performs the settings for the table that will control
from where the statistical data used by the optimizer will be taken.
*/
void set_statistics_for_table(THD *thd, TABLE *table)
{
uint use_stat_table_mode= thd->variables.optimizer_use_stat_tables;
uint use_stat_table_mode= thd->variables.use_stat_tables;
table->used_stat_records=
(use_stat_table_mode <= 1 || table->read_stat.cardinality_is_null) ?
table->file->stats.records : table->read_stat.cardinality;
......
......@@ -3748,14 +3748,14 @@ static Sys_var_ulong Sys_progress_report_time(
SESSION_VAR(progress_report_time), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(56), BLOCK_SIZE(1));
const char *optimizer_use_stat_tables_modes[] =
{"NEVER", "COMPLEMENTARY", "PREFERABLY", "EXCLUSIVELY", 0};
const char *use_stat_tables_modes[] =
{"NEVER", "COMPLEMENTARY", "PREFERABLY", 0};
static Sys_var_enum Sys_optimizer_use_stat_tables(
"optimizer_use_stat_tables",
"use_stat_tables",
"Specifies how to use system statistics tables. Possible values are "
"NEVER, COMPLEMENTARY, PREVERABLY, EXCLUSIVELY",
SESSION_VAR(optimizer_use_stat_tables), CMD_LINE(REQUIRED_ARG),
optimizer_use_stat_tables_modes, DEFAULT(0));
"NEVER, COMPLEMENTARY, PREVERABLY",
SESSION_VAR(use_stat_tables), CMD_LINE(REQUIRED_ARG),
use_stat_tables_modes, DEFAULT(0));
static Sys_var_mybool Sys_no_thread_alarm(
"debug_no_thread_alarm",
......
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