MySQL でオプティマイザトレース(Oracle Database でいう 10053 トレース)を取得する方法。
mysql> SET optimizer_trace="enabled=on"; mysql> SET optimizer_trace_max_mem_size = 1048576; mysql> select 1; mysql> select * from information_schema.optimizer_trace\G *************************** 1. row *************************** QUERY: select 1 TRACE: { "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "expanded_query": "/* select#1 */ select 1 AS `1`" } ] } }, { "join_optimization": { "select#": 1, "steps": [ ] } }, { "join_execution": { "select#": 1, "steps": [ ] } } ] } MISSING_BYTES_BEYOND_MAX_MEM_SIZE: 0 INSUFFICIENT_PRIVILEGES: 0 1 row in set (0.01 sec)