Explain SELECT Query
explain_select_queryRun EXPLAIN on a SELECT query to view its execution plan without retrieving data—diagnose slow queries before executing on large Magento tables.
Instructions
Runs EXPLAIN on a validated SELECT query to show the execution plan without returning row data. Use to diagnose slow queries before running them on large Magento tables.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | No | Read-only SQL starting with SELECT, SHOW, DESCRIBE, or EXPLAIN. Alias: query. | |
| query | No | Alias for sql — same parameter, alternative name. | |
| profile | No | Override the MAGENTO_SQL_PROFILE env var for this call only. Use list_connection_profiles to see available names. | |
| magentoRoot | No | Absolute path to the Magento root (must contain app/etc/env.php). Defaults to MAGENTO_ROOT env var or auto-discovery. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| rows | Yes | ||
| sampled | No | ||
| rowCount | Yes | ||
| truncated | No |