SQL Panel¶
Every tabular file you open in Octa is queryable via SQL. The active
table is exposed to an in-memory DuckDB connection as a table
called data. Press Ctrl+Enter in the editor and your query runs
against the loaded rows.

Opening the SQL panel¶
Four ways:
- Analyse → SQL in the toolbar (visible when the active tab is on a tabular file in Table view).
- The
ToggleSqlPanelshortcut (default Ctrl+J). - New SQL editor (default Ctrl+T) opens the panel when it is closed, and another editor when it is open.
- Auto-open on file load via Settings → SQL → Open SQL panel by default.
The panel docks to the bottom by default. Change the side under Settings → SQL → Panel position (Bottom, Top, Left, or Right). The SQL panel is independent of the Chart tab; the Analyse menu also opens a chart in a new tab, and the two features can be used together.
Maximise and keep open¶
Maximise in the panel header lets the panel fill the window; Restore docks it again. Opened on an empty tab (no file yet) the panel starts maximised, since there is no table for it to sit beside. Opening a file into that tab docks it.
An editor stays until you close it. Closing its tab, opening a file into it or refreshing it leaves the editor as it was: its text, file, result, connection and workspace all stay, and a query still running lands its result there.
When you close the tab on screen, the tab that becomes active takes over your editors, as long as it shows a table and its own editors are empty. Otherwise your editors get a tab of their own at the end of the tab bar, and so they do when you close a tab in the background, so the tab you are looking at does not change.
Three things do close an editor: its own x in the panel, closing the tab after closing the panel, and closing a tab that holds nothing but editors while no other tab can take them.
Closing Octa ends your editors too, unless Reopen last session is on: then their text and files come back at the next start, without connecting to anything.
Switch this off under Settings → SQL → Keep the SQL editor open; the editor then belongs to its tab and closes with it.
Inside the panel, the workspace tree, the Inspector, the editor and the results are stacked panes sharing the panel's height. Drag the line between any two of them to move the boundary: the space comes from the pane next to it, the others stay where they are, and nothing is ever drawn over anything else. Drag the panel's outer edge to give all of them more room at once.
Writing a query¶
The editor is a multi-line TextEdit with:
- Line numbers in a left gutter (greyed out, monospace).
- Monospace code throughout, defaulting to JetBrains Mono bundled with Octa. Switch to system monospace or match-UI font under Settings → SQL → Editor font.
- Right-click menu for Copy
- Several carets: Alt+click or Shift+Alt+Down adds one (by default, both can be changed), and typing then happens on every line at once, like in VS Code. See Typing on several lines at once. Autocomplete waits while there is more than one caret.
- Faded comments: everything after
--on a line is drawn faded, so what runs stands out from what does not. A--inside a quoted string is text, not a comment. - Comment / uncomment with F12: mark one or more lines (or just put
the caret on one) and press F12. Each marked line gets
--in front of its first character; if every marked line already starts with--(leading blanks ignored), that first--is removed instead, so pressing twice gets you back. With a mix, everything is commented. Blank lines are left alone, and only the first--goes, so-- -- xbecomes-- x. A--after code (SELECT a -- note) does not count, unless the selection lies only inside that comment: then just that--is removed. Rebind it under Settings -> Shortcuts.
Finding and replacing¶
With the keyboard in the editor, Ctrl+F opens the find box over the
editor's top right and Ctrl+H the same box with its replace row under the
find field, as in VS Code. Text marked on one line becomes the search.
Matches are found in any case and highlighted in the editor, the box counts
them (2 / 5), and Enter or > goes to the next one, Shift+Enter or
< to the previous one, while the keyboard stays in the box. Aa matches
capitalisation, W whole words only, .* reads the text as a regular
expression. Replace, or Enter in the replace field, swaps the current
match and moves on, All swaps every match in the editor. The replacement
goes in exactly as typed (with .* on, $1 inserts what the first group
matched), and Ctrl+Z in the editor takes it back. Escape or the x
closes the box and puts the caret back in the editor, after the last match
you went to.
Each editor has its own box. Outside the SQL editor Ctrl+H opens the same box over the table or text: see Find & Replace.
Formatting a query¶
Format in the toolbar lays the query out one clause per line, indented, so a long one-liner pasted from a log becomes readable:
SELECT
c.name,
count(*) AS orders
FROM
customers c
JOIN orders o ON o.customer_id = c.id
GROUP BY
c.name
With part of the editor marked, only that part is formatted; otherwise
the whole editor is. Comments are kept, and only whitespace, keyword case
and comma placement change, so the query means the same afterwards.
When Run on points at a SQL Server connection, [bracketed names]
are kept whole.
The style is yours to choose under
Settings -> SQL, with a live preview:
keywords in upper case, lower case or as written, indentation of 2
spaces, 4 spaces or a tab, commas at the end of a line or at the start
of the next (, b), JOIN level with FROM or indented under it, how
long a list may be and still stay on one line, how long a clause may be
and stay on its keyword's line (GROUP BY c.name), how long a bracket
may be and stay on one line (coalesce(a, 0)), how many blank lines
separate two statements, and whether the text ends with a semicolon.
Whole query on one line only tidies spacing and keyword case and
breaks nothing, for pasting into a log or a program. Format SQL can also be put on a key under
Settings -> Shortcuts.
Autocomplete¶
While you type a word, Octa shows a row of chip-style suggestions
beneath the editor, listing the column names, table, schema and
catalog names, and SQL keywords that contain what you typed, anywhere in
the name: se finds session, house and user_id. Names that start
with it come first. The list belongs to typing: moving the
caret any other way (a click, the arrow keys, Home or End) closes it, and
it never opens for marked text, so marking a column name and pressing
Enter or Tab does what it does anywhere else. Each part of
a dotted name completes on its own, so wh.sales.orders completes at
wh, at sales and at orders. On a tab opened from a live database
connection and running on the server, the server's catalogs, schemas
and tables are offered as well: the tab's own catalog and schema are
listed in the background when the panel opens, and anything you have
expanded in the Databases sidebar joins them. The same works on any tab
whose Run on points at a connection. Typing sales. lists that
schema's tables, and every server table the query names has its columns
fetched once in the background, so SELECT o. offers the columns of
orders a moment after you wrote FROM sales.orders o. Column names
with accents or umlauts complete like any other. The list scrolls when
more names match than fit. Click a chip to insert, or drive the popup from
the keyboard: Up / Down move the highlight, Enter or Tab
accept the highlighted suggestion, Esc closes the list and leaves the
caret where it is, so the next Enter is a line break. These keys are
only intercepted while the popup is open, so with no suggestions
showing Enter and the arrows behave normally, and Esc leaves the editor. Disable under
Settings → SQL → Autocomplete.
The editor also takes keyboard focus the moment the panel opens, so you
can start typing immediately without clicking into it first. The faded
line an empty editor shows (SELECT * FROM data LIMIT 1000, or the
server table on a database tab) is a template: press Tab and it
becomes real text, ready for Ctrl+Enter.
Running a query¶
- Ctrl+Enter runs the entire query.
- Mark part of the editor and Ctrl+Enter runs only the marked part. Keep several statements in one editor and run them one at a time.
- A Run button in the toolbar does the same as Ctrl+Enter, marked part included.
- A Clear button empties the editor.
- Run on picks where the query runs: local DuckDB (the workspace below), or any saved database connection. Picking a connection sends the query straight to that server in its own SQL dialect, where every table is queryable by its real name. Nothing is attached or copied, so this is the fast way to query a database from an empty SQL editor. A tab opened from a database starts on its own connection. A library is there for the one thing direct mode cannot do: joining a server's tables with local files.
- While a query runs, the result area shows a spinner and how long
it has been running, in place of the previous result. A query on a
server, or on the local DuckDB, can be cancelled right there, and Run
turns into Cancel in the toolbar meanwhile. The window keeps
responding while either runs. A statement that changes
data(UPDATE, DELETE, INSERT) keeps the tab read-only until its result is folded back; a plain SELECT leaves the tab alone.
Several editors side by side¶
+ in the toolbar (or Ctrl+T, also while typing) opens another editor next to the others, each with its own query and its own result underneath. Click into an editor (or its result) to make it the active one: Run, Ctrl+Enter, Format, History, Export and Open result as tab all act on it, and it gets a thin outline. The small × above an editor closes it and its result; the last one stays. The workspace, Run on and Ask are shared by all of them.
Copying from the result¶
Click a cell to select it. Ctrl+click adds or removes more cells, Shift+click adds the rectangle from the last clicked cell, and a row number selects the whole row (Ctrl+click adds more). Double-click any cell to mark its whole row without going back to the row number, and do it again to take the mark off. Ctrl+double-click adds or removes a row among several.
A click on a column header marks only the column's name: Ctrl+C then copies the name, ready to paste into the query. Ctrl+click marks several names, which copy as one tab-separated line, left to right. Double-click a column header to select the whole column; Ctrl+double-click adds or removes one column among several.
Ctrl+C copies the selection as tab-separated text, one line per row, ready to paste into a spreadsheet. Right-click a cell for Copy cell, Copy row, Copy column, Copy selection and Copy all. Right-click a column header for Copy column name(s): the name of that column, or of every marked or selected column, one per line, when it is among them (as in the table's own header).
Fit columns in the panel's toolbar makes every result column as wide as its name and its longest loaded value need, however far down that value is, with no upper limit. Each column starts at a width taken from its name and first rows; drag a column's edge to change one by hand. The Auto-fit SQL result columns shortcut does the same and is unbound by default.
Each tab owns a persistent DuckDB workspace: what a query set up there (the other tabs' copies, the libraries it reached) survives across runs and is dropped when the tab closes. See The workspace below.
The workspace¶

The collapsible Workspace section above the editor lists everything your queries can reach:
data- the active table, unsaved edits included. Octa copies it into DuckDB in the background when the panel opens and again at the first Run after the table changes, so querying an unchanged table again costs no copy. refresh next todatacopies it at once. The status bar says when a copy is running, and the tab is read-only until it is done, about a second per million rows; a Run started meanwhile waits for it. On a large-file tab,datais the whole file instead, scanned where it lies, not the page on screen: acount(*)counts every row of it.- Your other open tabs, each under a SQL-safe version of its own tab name. Nothing to set up: open two files and join them by name. The panel says once which names it registered, and the note can be dismissed. Switch it off under Settings -> SQL -> Query other open tabs. The copy runs in the background, and the status bar says so while it does. Tabs above Max rows to register (200,000 by default) are left out, because registering a tab copies its rows into DuckDB.
- Tabs from a live database connection are deliberately not copied. When the query runs on the server, every table on that server is already reachable by its real name, so a join between two tables of the same database happens where the data lives rather than after copying both into DuckDB. The panel says so above the workspace list.
- Your libraries: every database, schema, table, folder, file or
cloud folder you gave a name under Settings > Libraries. With the
Libraries button beside Run on switched on, a query uses them
by that name (
FROM sales.orders,FROM raw.events), together and withdataand your tabs; switched off, they are greyed and a query naming one is not run. Opening a library's triangle lists its schemas and tables, as the Databases sidebar does, and is the only thing in the list that connects. Each library's row says whether a query used it yet. + New library... opens the form. See Libraries.
Clicking a table in the list opens it in the Inspector: columns, types, and a sample of rows.
The workspace also works with no table open at all: open the panel
via Analyse > SQL on an empty tab and query your libraries directly
(joins and UNIONs across servers, folders and cloud objects included);
there is simply no data table until you open a file.
History and snippets¶
The SQL toolbar has two ways to reuse queries:
-
History is a dropdown listing the queries you have actually run, most recent first, each with where it ran (the connection, the cloud object or the file), how long it took and how many rows it returned. Hover an entry to see the whole query with its line breaks and when it ran. Pick one to add it below what the editor already holds; it comes in marked, so Run runs just that query (where the query runs stays as it is). Use Clear history at the bottom to forget the lot.
History is one list, kept between sessions: every SQL editor, whatever tab or connection, shows the same queries. It lives in
sql_history.jsonin the config directory; a file written by an earlier version, which kept one list per connection, is merged into the single list on first start.Settings -> SQL -> Query history controls it: Keep the queries I run is on by default and keeps the last 20 in total (0 keeps them all). Turning it off stops recording and deletes what was kept, because a query can carry values out of your data and a switch that leaves the old file behind would be a poor kind of off. Re-running a query moves it back to the top rather than adding a second copy. A picked query replaces the editor text (off by default) makes a query picked here or inserted from Snippets replace what the editor holds instead. - Snippets opens a manager window for a persistent, named library of queries. Save current query as snippet... stores the editor content under a name and an optional description; each saved snippet has Insert (add it below the editor text, marked so Run runs just that query, the same as History) and x (delete, after a question you can switch off with Don't ask again or in Settings > SQL). The window has the usual minimise / maximise / close controls and is resizable. Snippets are stored in
sql_snippets.jsonin the config directory, so they survive restarts and are shared across all tabs.
Saving and opening SQL files¶
The File button in the SQL toolbar reads and writes plain .sql files,
so a query can live next to your project rather than only inside Octa.
- Open... reads a
.sqlfile. An empty editor takes it; an editor that already holds text keeps it, and the file opens as a new editor after the others (appended at the right). A file bigger than the text size limit (Settings -> Performance -> Raw view size cap) is refused with a message. - Save writes the editor back to the file it came from. An editor that has no file yet asks where to save it, the same as Save as.... Ctrl+S does the same while you are typing in the editor; anywhere else it still saves the table.
- Save as... writes the query to a new file, which the editor keeps from then on.
An editor with a file shows its name above the text (with the editor number
in front when there are several), followed by * while the text differs
from what is on disk. Hover the name for the full path. Saving writes to a
temporary file first, so a failed save leaves the old file intact; a read or
write error shows in the result area of that editor. Octa does not ask about
unsaved changes when you close an editor, a tab or the app, so save first if
you want to keep them. With
Reopen last session on, the editor
comes back with your text and its file, showing * if the two differ. A file
keeps its line endings: one written on Windows with CRLF is
saved with CRLF again.
With Keep earlier versions on, Save keeps the file it replaces like any other save.
Open SQL file... and Save SQL file as... can be given a key under Settings -> Shortcuts; they ship without one.
Ask¶
Under the toolbar there is an Ask box, on a row of its own with the Ask button, the assistant picker, the Questions menu and a clear button. Type what you want in plain words ("revenue per country, biggest first") and Octa writes the SQL into the editor at your cursor. The rest of the editor is left alone, so you can ask for one piece of a query you are already writing.
The box starts one line tall and grows as you type, so a long question stays readable instead of scrolling sideways out of sight. Enter sends the question and Shift+Enter starts a new line.
Beside the box, a dropdown picks which assistant answers, the same control the search bar's Ask has. It is per tab and starts on whatever the chat panel is set to, so you can send one question to a bigger model without changing the panel. It only appears when more than one profile is configured, since with one there is no choice to make.
The query is never run for you. Read it, change it if you like, then
press Run. Only one statement that reads is ever produced (a SELECT, WITH,
VALUES or DuckDB's FROM, with as many UNION ALL parts as it takes). A reply
with a second statement, or one that writes anywhere in it, is rejected and
nothing is inserted.
Your question stays in the box after the answer, after an error and when you pick another assistant, so you can change it and ask again. The next answer then takes the place of the query Ask wrote before, as long as you have not changed that query. Otherwise it goes in at the cursor. Undo in the line under the box puts the editor back to how it was before the answer. Ask sees what the editor holds and the question before, so now only 2024 works.
- The x button clears the question and the message under it. The editor stays as it is.
- Questions lists what you asked here before, the latest first. Picking one puts it back into the box and sends nothing. Clear questions forgets them. How many are kept is set under Settings > Chat / Assistant > Global options > Questions Ask remembers (50, and 0 keeps none).
- The line under the box shows who is asked and for how long, with Cancel. Afterwards it says what came of it. An error stays there, to read and copy, until the next question.
Checked before you see it. For a query on your local tables, Octa lets DuckDB
check the query against empty copies of them, without running it. If DuckDB would
refuse it, the assistant is told why and corrects it once. If it still fails, the
query is inserted all the same and DuckDB's reason stands under the box. A query
for a database server is not checked, and neither is one while a library's
name.table tables are part of the workspace.
Ask never picks a table for you. The table of the tab counts as chosen, and so does any table you name in your question. With neither, it writes a standalone query from your words, with placeholder names to replace, or builds the data you ask for with VALUES or generate_series.
With a table in the tab, Ask sends its column names, their types and the row
count to the chat profile configured under
Settings > Chat / Assistant, with the text in the editor, the question
before and today's date. It does not send the data itself, unless you switch on
Ask sends example values there (off by default): then up to five different
values of each column go along, from the rows already loaded, so that Germany
can become DE. Hover the box to see which of the two applies.
It also sends the workspace: every table registered from another tab and every table of a library a query in this editor already used, with their columns, so it can write a join across them and call each one by its real name. The list is capped at 12 tables and 40 columns apiece to keep the request small. A library no query used yet is not reached for this.
On a tab with no table of its own, or one set to run on a connection it has no
table on, Ask describes only the tables your question names: the whole name in
any case, so "orders" finds orders but "order" does not. It looks in the
workspace or, set to run on a connection, in that connection's schemas. On
engines with catalogs (Snowflake, Databricks, BigQuery) those are the schemas you
have opened in the Databases sidebar. Nothing else about the connection is sent
to the assistant.
When the panel is set to run on a server, the query is written in that
database's dialect against the real schema.table name instead of
data, and the row count is the table's own, not the size of the page
currently on screen. The foreign keys the database declares are read first.
When the connection is busy or slow, Ask waits five seconds for them and then
goes on without.
Ask is greyed out only when no chat profile is set up. Hover it to see whether a table is chosen.
What's available¶
DuckDB's full SQL surface, including:
- Window functions:
ROW_NUMBER(),RANK(),LAG(), etc. - Aggregations:
SUM,AVG,COUNT,MEDIAN, percentiles, etc. - JSON functions:
json_extract,unnest, … - Date/time functions, string functions, regex functions.
- CTEs (
WITH ... AS (...)), subqueries, correlated subqueries. PIVOT/UNPIVOT.DESCRIBE datato see the column types DuckDB sees.
The placeholder query shown when the editor is empty is
SELECT * FROM data LIMIT {settings_default} (the default row
limit is configurable under
Settings → SQL → Default row limit).
This is only a hint; your editor field is actually empty, so type to
replace.
Queries from DuckDB 1.x¶
Octa's SQL engine is DuckDB 2.0. A query written for an older version runs the same, apart from these:
| In the query | Before | Now |
|---|---|---|
list_transform(l, x -> x + 1) |
accepted | an error, write lambda x: x + 1 |
a // b and a % b where b is 0 |
NULL | an error, TRY(a // b) gives NULL again |
text ~ 'pattern' |
the whole text has to match | a match anywhere in the text is enough, regexp_full_match(text, 'pattern') asks for the whole text |
X'41' |
text | bytes |
a / b still gives infinity where b is 0.
Files are safe to hand on. A .duckdb file Octa makes opens in DuckDB 1.0 and
later (1.5 and later when it holds a VARIANT column), and a file that was there
before keeps the format it has.
Result rendering¶
Results render in a table below the editor, with a row counter
directly above the grid, followed by how long the query took in
brackets (1234 result rows (84 ms), switching to seconds past one
second). The timing covers the query itself, and for a query run on a
live connection it covers the round trip to the server. A query that
fails is timed too, so a slow statement that ends in an error still
tells you where the minute went. The counter is display-only: it is
never a column of the result and never lands in an export. Numbers show
with thousand separators and in the number style you chose for
tables (Settings -> Table View),
display only like there: Copy, Export and Write result to DB carry the
plain values. The result table is a
separate egui_extras::TableBuilder from the main
Table view (no edit overlay, no row selection
beyond click-to-select-text).
Results arrive one page at a time. A SELECT is computed once inside
DuckDB and the first
Result rows per page rows (1,000 by
default) are handed to the grid; scrolling near the end fetches the next
page. The row counter shows both numbers, 1,000 / 8,432,109 result
rows, and that total is an exact count(*) over the whole result, not
"we stopped counting here". Set the page size to 0 to load every row at
once.
Paging is a display decision only. Export and Write result to DB read past the page on screen. A DuckDB file takes every row. A SQLite file stops at the Initial-load row cap (Settings → Performance, default 2,000,000): the rows up to it are written, and a banner on the tab says so until you dismiss it. Raise the cap and write again to get them all.
Queries run on a live database connection are not paged: they honour the initial-load row cap as before (Settings → Performance, default 2,000,000), and the row counter says so when a result stops there ("row cap reached, result truncated"). Raise the cap, or narrow the query, to see more.
Errors render in red below the editor.
CREATE TABLE opens a new tab¶
A CREATE TABLE or CREATE VIEW statement turns into a new tab named
after the table, with the declared columns and types:
gives an empty grid to type into, and
gives a tab holding those rows. Either way the tab you ran it from is untouched, so this works from an empty tab with nothing open (the SQL panel opens there too), and it is not blocked by read-only mode: a new tab is not an edit. Save the new tab like any other table.
The table is handed over rather than kept: after the statement, people
is no longer queryable from the original panel. Switch to the new tab and
it is data there. CREATE OR REPLACE of a table that already exists
(data included) is an ordinary mutation of that table, and a CREATE
inside a library is left to its source (libraries are read-only, so
DuckDB refuses it).
On the command line, octa --sql file -q "CREATE TABLE ..." prints the
created table; the run_sql MCP tool returns it as result with
"created": "<name>".
Mutations¶
INSERT / UPDATE / DELETE queries run via conn.execute()
instead of conn.query(). After a mutation, Octa re-selects the
full data table and replaces the base table in the active
tab, so the mutation's effect is visible immediately.
To make the effect easy to spot, Octa briefly highlights the changed cells and any new rows in green after a mutation. Toggle this and set its duration under Settings → SQL (Highlight SQL changes / Highlight duration, on by default, 4 seconds). The highlight is a temporary display mark and clears itself.
Mutations don't persist back to disk by default
A mutation changes the in-memory table only, so it is lost when you close Octa unless you also save the file via File → Save.
For files Octa supports writing (CSV, Parquet, SQLite, …), saving after a mutation persists the change. For read-only formats (SAS, HDF5, …) the change is in-memory-only, though you can Save as to a writable format to export it.
Opening a result as a tab¶
Open result as tab... in the toolbar opens the whole result as a new tab of its own, named "SQL result". Every row goes in, not only the page on screen, and the tab behaves like any other table: edit it, filter it, chart it or save it. The SQL panel's own tab and its workspace stay as they were.
Exporting results¶
The toolbar's Export… button (and the Ctrl+Shift+E shortcut) saves the current SQL result as a separate file. The dialog accepts any writable format Octa supports: Parquet, CSV, JSON, SQLite, etc.
Examples¶
-- Count rows per category
SELECT category, COUNT(*) AS n
FROM data
GROUP BY category
ORDER BY n DESC;
-- First / last per user
SELECT user_id,
MIN(timestamp) AS first_seen,
MAX(timestamp) AS last_seen
FROM data
GROUP BY user_id;
-- Rows containing JSON
SELECT id, json_extract(payload, '$.user.email') AS email
FROM data
WHERE payload IS NOT NULL;
-- Window function: rolling 7-day count
SELECT date,
COUNT(*) OVER (
ORDER BY date
RANGE BETWEEN INTERVAL 6 DAY PRECEDING AND CURRENT ROW
) AS rolling_7d
FROM data;
-- DESCRIBE for schema discovery
DESCRIBE data;
Limitations¶
- Live-database results are not paged. A query run on the server still materialises up to the initial-load row cap in one go; only local DuckDB results arrive page by page.
- No DDL persistence.
CREATE TABLE other AS SELECT ...succeeds but the new table dies with the connection on the next Ctrl+Enter. - Add-ons need a network once. DuckDB downloads most of its add-ons by itself
the first time a query needs one, such as
excelforread_xlsx. A few, such asspatial, you load yourself withINSTALL spatial; LOAD spatial;. Which Octa downloads lists the ones its own features use.
For multi-file analysis the CLI's
octa --sql FILE -q 'SELECT ...' is a good
companion: it spins up a fresh DuckDB and you can layer ATTACH /
COPY however you want.
Explain a query¶
Explain sits beside Run. It shows how the database would carry out a
query, without running it. It takes the marked text, or the whole editor
when nothing is marked, and explains one statement at a time. Nothing is
executed (Octa never uses EXPLAIN ANALYZE), so it is safe on read-only
connections, and explaining a DELETE deletes nothing. A semicolon anywhere
but at the end is refused, even inside text or a comment, so nothing after
it can reach the database.
The plan comes in three views, and the choice is remembered per editor:
- In plain words (first): the steps numbered in the order the database works through them, with plain names, the table each step reads and the rows the database expects. Each step also says what sets it apart, in the query's own terms: the condition it keeps rows by, how many rows a limit keeps, what a group or sort goes by. A join or union says which earlier steps it combines. Steps that have no plain name (internal bookkeeping such as Spark's exchanges) are left out here; the other two views show every step.
1. Read whole table: orders, keeps rows where amount > '10'::numeric, ~993 rows
2. Read whole table: customers, ~50 rows
3. Join (hash), uses steps 1 and 2, ~993 rows
4. Group: by c.name, ~50 rows
5. Sort: by (sum(o.amount)) DESC, ~50 rows
6. Limit, ~5 rows
- Table: the same steps as rows, with depth, step, table, estimated rows, detail and server_name (the server's own name for the step).
- Server's own: the plan exactly as the server printed it, with every technical detail.
Explain works on local DuckDB, DuckDB file connections, PostgreSQL, MySQL / MariaDB, Databricks and BigQuery. On other engines the button is greyed out and its hover text names the engine. On BigQuery the plan shows the bytes the query would read, never a price. Databricks plans carry no row estimates, so that column stays empty there. Databricks also filters while it reads, so the condition shows on the table read, and it groups and sorts in two rounds (each part of the data first, then all of it together), so those steps can appear twice.
On the local DuckDB, Explain does not run while a query runs or the table is still being copied into SQL; the editor says so. Press it again once that is done. When the table changed since the last Run, Explain copies it first, in the background, and shows the plan when the copy is done.
The shortcut Explain query plan ships unbound; bind it under Settings > Shortcuts.
Command line and MCP¶
The same job without the GUI:
- MCP:
run_sql(explain: truereturns the plan)
See also¶
octa --sqlis the CLI form of this panel.- Settings → SQL covers autocomplete, panel position, default row limit, and editor font.
- Search & Filter covers value-based filtering that does not need SQL.
- Chart opens the active table in a new chart tab from the same Analyse dropdown.