1SET @start_global_value = @@global.optimizer_trace;
2SELECT @start_global_value;
3@start_global_value
4enabled=off,one_line=off
5select @@global.optimizer_trace;
6@@global.optimizer_trace
7enabled=off,one_line=off
8select @@session.optimizer_trace;
9@@session.optimizer_trace
10enabled=off,one_line=off
11show global variables like 'optimizer_trace';
12Variable_name	Value
13optimizer_trace	enabled=off,one_line=off
14show session variables like 'optimizer_trace';
15Variable_name	Value
16optimizer_trace	enabled=off,one_line=off
17select * from information_schema.global_variables where variable_name='optimizer_trace';
18VARIABLE_NAME	VARIABLE_VALUE
19OPTIMIZER_TRACE	enabled=off,one_line=off
20select * from information_schema.session_variables where variable_name='optimizer_trace';
21VARIABLE_NAME	VARIABLE_VALUE
22OPTIMIZER_TRACE	enabled=off,one_line=off
23set global optimizer_trace=1;
24select @@global.optimizer_trace;
25@@global.optimizer_trace
26enabled=on,one_line=off
27set session optimizer_trace=1;
28select @@session.optimizer_trace;
29@@session.optimizer_trace
30enabled=on,one_line=off
31set global optimizer_trace=0;
32select @@global.optimizer_trace;
33@@global.optimizer_trace
34enabled=off,one_line=off
35set session optimizer_trace=0;
36select @@session.optimizer_trace;
37@@session.optimizer_trace
38enabled=off,one_line=off
39set session optimizer_trace=default;
40select @@session.optimizer_trace;
41@@session.optimizer_trace
42enabled=off,one_line=off
43set global optimizer_trace=1.1;
44ERROR 42000: Incorrect argument type to variable 'optimizer_trace'
45set global optimizer_trace=1e1;
46ERROR 42000: Incorrect argument type to variable 'optimizer_trace'
47set session optimizer_trace="foobar";
48ERROR 42000: Variable 'optimizer_trace' can't be set to the value of 'foobar'
49SET @@global.optimizer_trace = @start_global_value;
50SELECT @@global.optimizer_trace;
51@@global.optimizer_trace
52enabled=off,one_line=off
53