Bug #65332 optimizer_trace_limit does not work if set to value greater than 1
Submitted: 16 May 2012 12:48 Modified: 16 Oct 2012 5:16
Reporter: Sveta Smirnova Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.6.6 OS:Any
Assigned to: CPU Architecture:Any

[16 May 2012 12:48] Sveta Smirnova
Description:
If set optimizer_trace_limit to value greater than 1 I can not get more than 1 trace;

How to repeat:
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> set optimizer_trace_limit=10;
Query OK, 0 rows affected (0.00 sec)

mysql> set optimizer_trace ="enabled=on";
Query OK, 0 rows affected (0.00 sec)

mysql> select count(*) from mysql.user;
+----------+
| count(*) |
+----------+
|        4 |
+----------+
1 row in set (0.01 sec)

mysql> SELECT count(*) FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from mysql.host;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

mysql> SELECT count(*) FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)

Suggested fix:
I want to have up to 10 traces in table INFORMATION_SCHEMA.OPTIMIZER_TRACE if this variable set to 10.
[1 Nov 2012 16:59] Sveta Smirnova
Explanation why it was closed:

you should also set optimizer_trace_offset to -10 http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_optimizer_trace...:

set optimizer_trace_offset=-10;