summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sys_vars/t/optimizer_selectivity_sampling_limit_basic.test
blob: 232ff99db7468a260671abd01bf20b5d9c93c758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

--source include/load_sysvars.inc

#################################################################
#      START OF optimizer_selectivity_sampling_limit TESTS       # 
#################################################################


#############################################################
#                 Save initial value                        #
#############################################################

SET @start_global_value = @@global.optimizer_selectivity_sampling_limit;
SELECT @start_global_value;
SET @start_session_value = @@session.optimizer_selectivity_sampling_limit;
SELECT @start_session_value;


--echo '#--------------------FN_DYNVARS_115_01-------------------------#'
#########################################################################
#     Display the DEFAULT value of optimizer_selectivity_sampling_limit  #
#########################################################################

SET @@global.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@global.optimizer_selectivity_sampling_limit;

SET @@session.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@session.optimizer_selectivity_sampling_limit;


--echo '#--------------------FN_DYNVARS_115_02-------------------------#'
#########################################################################
#     Check the DEFAULT value of optimizer_selectivity_sampling_limit    #
#########################################################################

SET @@global.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@global.optimizer_selectivity_sampling_limit = 100;

SET @@session.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@session.optimizer_selectivity_sampling_limit = 100;


--echo '#--------------------FN_DYNVARS_115_03-------------------------#'
#############################################################################################
# Change the value of optimizer_selectivity_sampling_limit to a valid value for GLOBAL Scope #
#############################################################################################

SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 9;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 10;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 11;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 7777;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 4294967294;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 4294967295;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 4294967296;
SELECT @@global.optimizer_selectivity_sampling_limit;


--echo '#--------------------FN_DYNVARS_115_04-------------------------#'
#############################################################################################
# Change the value of optimizer_selectivity_sampling_limit to a valid value for SESSION Scope#
#############################################################################################
 
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 9;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 10;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 11;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 7777;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 4294967294;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 4294967295;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 4294967296;
SELECT @@session.optimizer_selectivity_sampling_limit;


--echo '#------------------FN_DYNVARS_115_05-----------------------#'
###############################################################################
# Change the value of optimizer_selectivity_sampling_limit to an invalid value #
##############################################################################

--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.optimizer_selectivity_sampling_limit = ON;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.optimizer_selectivity_sampling_limit = OFF;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.optimizer_selectivity_sampling_limit = 65530.34;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.optimizer_selectivity_sampling_limit = test;

--echo '#------------------FN_DYNVARS_115_06-----------------------#'
####################################################################
#   Check if the value in GLOBAL Table matches value in variable   #
####################################################################


SELECT @@global.optimizer_selectivity_sampling_limit = VARIABLE_VALUE 
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
WHERE VARIABLE_NAME='optimizer_selectivity_sampling_limit';

--echo '#------------------FN_DYNVARS_115_07-----------------------#'
####################################################################
#  Check if the value in SESSION Table matches value in variable   #
####################################################################

SELECT @@session.optimizer_selectivity_sampling_limit = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
WHERE VARIABLE_NAME='optimizer_selectivity_sampling_limit';


--echo '#---------------------FN_DYNVARS_115_08----------------------#'
###############################################################################
#  Check if global and session variable are independent of each other         #
###############################################################################

SET @@optimizer_selectivity_sampling_limit = 10;
SET @@global.optimizer_selectivity_sampling_limit = 30;
SELECT @@optimizer_selectivity_sampling_limit = @@global.optimizer_selectivity_sampling_limit;


--echo '#---------------------FN_DYNVARS_115_09----------------------#'
###############################################################################
#    Check if accessing variable with SESSION,LOCAL and without SCOPE points  #
#    to same session variable                                                 #
###############################################################################

SET @@optimizer_selectivity_sampling_limit = 20;
SELECT @@optimizer_selectivity_sampling_limit = @@local.optimizer_selectivity_sampling_limit;
SELECT @@local.optimizer_selectivity_sampling_limit = @@session.optimizer_selectivity_sampling_limit;


####################################
#     Restore initial value        #
####################################

SET @@global.optimizer_selectivity_sampling_limit = @start_global_value;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = @start_session_value;
SELECT @@session.optimizer_selectivity_sampling_limit;

########################################################################
#                END OF optimizer_selectivity_sampling_limit TESTS     #
########################################################################