Koskamo

Query execution plans with EXPLAIN

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

EXPLAIN shows how MySQL would execute a statement, and it works with SELECT, DELETE, INSERT, REPLACE, UPDATE, and TABLE statements, displaying optimizer information about the execution plan including how tables are joined and in which order. DESCRIBE and EXPLAIN are synonyms to the parser, but in practice DESCRIBE is used for table structure and EXPLAIN for execution plans. The FORMAT option selects the output: TRADITIONAL presents tabular output, JSON displays the plan as JSON, and TREE gives tree-like output with more precise descriptions; TREE is the only format that shows hash join usage and is always used for EXPLAIN ANALYZE. In MySQL 8.4 the default format when no FORMAT option is given is determined by the explain_format system variable. EXPLAIN FORMAT=JSON supports an INTO clause that saves the JSON plan into a user variable, and EXPLAIN FOR CONNECTION connection_id reports the plan for a statement executing in another connection. Scope: MySQL 8.4. Reviewed October 4, 2026.

Source and provenance

Original source
dev.mysql.com
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.