Capturing and importing plans
funcionalActual, estimated and profile captures on each engine, EXPLAIN options per connection, and the 23 plan formats that open from a file or the clipboard.
There are two ways to get a plan into SQLly: capture one from a live connection, or bring one in from somewhere else. Either way it lands in the plan pane under the query tab, and every capture in the tab is kept so you can comparar them later.
Capturing from a connection
| Capturar | Dónde | Lo que hace | ¿Ejecuta la consulta? |
|---|---|---|---|
| Real | ⌘L, the plan button in the query bar, or Explicar consulta (Real, ejecuta la consulta) in the command palette | Runs the statement and records the plan with real row counts and timings. | Sí |
| Estimado | Query menu or command palette: Explicar consulta (plan estimado, sin ejecución) | Asks the optimizer for its plan. Row counts and costs are its guesses. | No |
| Perfil | Command palette: Explicar con perfil (solo SELECT) | An actual capture with the extra detail switched on (buffers, verbose output). Refused for anything that is not a SELECT. | Yes, SELECT only |
| Volver a capturar | Button on the plan pane | Captures the same kind of plan again, for example after adding an index. | Same as the original |
When a connection cannot produce the kind of plan you asked for, the plan button stays visible but disabled and its tooltip says why. On SQLite, libSQL and ClickHouse, which have no executed-plan form here, the Actual command points you at Estimated; on ClickHouse it also points at Información de consultas for the rows, bytes and memory a run used.
How each engine is captured
| Motor | Real | Estimado |
|---|---|---|
| SQL Server, Azure SQL | SET STATISTICS XML ON | SET SHOWPLAN_XML ON |
| PostgreSQL | EXPLAIN (ANALYZE, FORMAT JSON) plus the options you choose | EXPLAIN (FORMAT JSON) |
| MySQL 8 | EXPLAIN ANALYZE | EXPLAIN FORMAT=JSON |
| MariaDB | ANALYZE FORMAT=JSON | EXPLAIN FORMAT=JSON |
| SQLite | EXPLAIN QUERY PLAN, estimated only, never executes | |
| libSQL / Turso | EXPLAIN QUERY PLAN, estimated only (SQLite's plan over the network) | |
| DuckDB | EXPLAIN ANALYZE | EXPLAIN |
| ClickHouse | None (no EXPLAIN ANALYZE) | EXPLAIN json = 1, con las partes y gránulos que cada índice recortó |
| Oracle | STATISTICS_LEVEL = ALL, leídos de vuelta desde V$SQL_PLAN_STATISTICS_ALL | EXPLAIN PLAN FOR, leídos de vuelta desde PLAN_TABLE |
EXPLAIN options
The small chevron beside the plan button opens Explain options for the current connection. Choices are saved per connection, so a production server can keep a lighter capture than your laptop's database. The plan button's tooltip lists what is on.
- PostgreSQL: Analyze, Verbose, Costs, Buffers, Timing, Summary, Settings, WAL, Generic plan and Memory. Options the connected server's version does not support are greyed out with the version they need (Settings 12, WAL 13, Generic plan 16, Memory 17), and the panel shows the version it detected.
- MySQL and MariaDB: Analyze (runs the statement).
- Restablecer a valores predeterminados puts the connection back to SQLly's default options.
Importing a plan from another tool
Pegar plan desde el portapapeles y Abrir plan… (command palette, or the Paste and Open buttons on the pane) read the output each engine actually prints, not only the formats SQLly captures. You do not need a connection, and the plan does not have to come from the same machine.
| Motor | Formats that open |
|---|---|
| SQL Server | ShowPlan XML (.sqlplan files, XML copied out of a results grid or Query Store), SHOWPLAN_TEXT, SHOWPLAN_ALL y STATISTICS PROFILE text, with STATISTICS IO y TIME messages attached to their statement |
| PostgreSQL | EXPLAIN as text (including psql and pgAdmin borders, BUFFERS, WAL, Settings and JIT sections), JSON, YAML or XML |
| MySQL | The classic table, \G output, tab-separated rows, FORMAT=TREE, EXPLAIN ANALYZE, and both JSON versions |
| MariaDB | The classic table and ANALYZE FORMAT=JSON |
| Oracle | DBMS_XPLAN output (including ALLSTATS LAST), AUTOTRACE, and rows read from PLAN_TABLE |
| SQLite | EXPLAIN QUERY PLAN |
| DuckDB | EXPLAIN ANALYZE as box-drawing text or JSON |
| ClickHouse | EXPLAIN indexes = 1, actions = 1 text, EXPLAIN PIPELINE, y EXPLAIN json = 1 |
| CockroachDB | EXPLAIN y EXPLAIN ANALYZE |
| Trino | EXPLAIN ANALYZE |
| Spark SQL | EXPLAIN FORMATTED |
Format detection
The engine and format are recognised from the text itself, not the file extension. Shell prompts, Markdown code fences, line numbers, log prefixes and a plan pasted as a quoted JSON string are stripped first, so a plan copied out of a terminal, a chat or a ticket usually opens as it is. A file with several statements opens all of them, with a tab per statement.
When something cannot be read, the pane says what it looks like (“This looks
like SQLite bytecode”, a truncated XML file) with the line and column where reading
stopped, and shows How to get a plan that can be read for that engine.
SQLite's EXPLAIN sin QUERY PLAN, for example, is bytecode
rather than a plan.
Large plans
Plans with more than 500 operators are analysed in the background so the app stays responsive. The pane says it is analysing, and the status bar and the finding count are filled in when it finishes. If the analysis fails, the pane says so plainly and the raw operators are still there.