EXPLAIN statement is the main tool to understand how a statement is executed within a server. In MariaDB 10, this works not only with the
SELECT statements, but also with the
DELETE statements. The syntax of the
EXPLAIN statement is:
EXPLAIN [EXTENDED] <statement>;
EXTENDED clause adds a column to the output and generates a note (which can be seen with the
SHOW WARNINGS command) containing
statement as it has been internally rewritten by the optimizer.
After MariaDB 10, another property of this command was added, shown as follows:
SHOW EXPLAIN FOR <thread_id>;
This command allows us to obtain the execution plan from a running statement. This is useful when a statement is taking a lot of time and ...