Capturing and importing plans
정상 동작Actual, 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 비교 them later.
Capturing from a connection
| 캡처 | 위치 | 기능 | 쿼리를 실행하나요? |
|---|---|---|---|
| 실제 | ⌘L, the plan button in the query bar, or 쿼리 설명(실제, 쿼리 실행) in the command palette | Runs the statement and records the plan with real row counts and timings. | 예 |
| 예상 | Query menu or command palette: 쿼리 설명(예상 계획, 실행 없음) | Asks the optimizer for its plan. Row counts and costs are its guesses. | 아니요 |
| 프로필 | Command palette: 프로파일과 함께 설명(SELECT만) | An actual capture with the extra detail switched on (buffers, verbose output). Refused for anything that is not a SELECT. | Yes, SELECT only |
| 다시 캡처 | 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 쿼리 인사이트 for the rows, bytes and memory a run used.
How each engine is captured
| 엔진 | 실제 | 예상 |
|---|---|---|
| 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, 각 인덱스가 프루닝한 parts와 granules까지 포함해서 |
| Oracle | STATISTICS_LEVEL = ALL, 다음에서 다시 읽어 옵니다 V$SQL_PLAN_STATISTICS_ALL | EXPLAIN PLAN FOR, 다음에서 다시 읽어 옵니다 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).
- 기본값으로 재설정 puts the connection back to SQLly's default options.
Importing a plan from another tool
클립보드에서 실행 계획 붙여넣기 그리고 실행 계획 열기… (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.
| 엔진 | Formats that open |
|---|---|
| SQL Server | ShowPlan XML (.sqlplan files, XML copied out of a results grid or Query Store), SHOWPLAN_TEXT, SHOWPLAN_ALL 그리고 STATISTICS PROFILE text, with STATISTICS IO 그리고 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, 그리고 EXPLAIN json = 1 |
| CockroachDB | EXPLAIN 그리고 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 없이 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.