Skip to Content

Mysql get Optimizer Trace

Posted on
-- Step 1: Enable optimizer trace
SET optimizer_trace="enabled=on";

-- Step 2: Run the query
SELECT COUNT(\*) FROM table_name;

-- Step 3: Retrieve the optimizer trace
SELECT \* FROM information_schema.OPTIMIZER_TRACE;

-- Step 4: Disable the optimizer trace
SET optimizer_trace="enabled=off";
comments powered by Disqus