The query editor
The editor is where you write SQL, run it and shape how many rows come back. This page covers the tab strip, the toolbar, autocomplete, formatting, running and cancelling, the row limit, the command palette and the keyboard shortcuts.

Tabs
The strip above the editor holds one tab per query.
- Press + to add a tab. A new tab is called Query 2, Query 3 and so on, contains
SELECT 1and uses a limit of 1,000 rows. It starts with no database chosen; if the workspace has only one database, the Explorer selects it for you. - Click a tab title to switch to it.
- Double-click a title to rename the tab. The old name is selected, so typing replaces it. Press Enter to keep the new name, or Escape to cancel. An empty name keeps the old one.
- Hover over a tab and press × to close it. The last remaining tab cannot be closed.
- Opening a saved query or a table preview (see The schema browser) always opens a new tab, so it never overwrites what you were writing. The new tab is named after the saved query or the table.
Every tab keeps its own SQL, its own database choice and its own row limit. Tabs are stored in your browser, per workspace, so they survive a page reload but not a change of browser or cleared site data.
While the page is open, a tab you leave also keeps its state: the result grid with its sort and filter, the run status, the parameter values and the editor's undo history. A query that is still running goes on running in the background, and its result is there when you come back. A page reload clears results and parameter values; the SQL, database and limit come back from the browser.
The toolbar
From left to right:
| Control | What it does |
|---|---|
| Run | Runs the query. Reads Run selection while some text is selected. |
| Cancel | Asks the engine to stop the running query. Disabled when nothing is running. |
| Format | Reformats the editor text. |
| Limit | The maximum number of rows to return. |
| Connection badge | Shows the connection and engine for this tab, for example trino-demo · trino, or No connection before one is chosen. Read only. Change the database in the Explorer. |
| Status badge | Running…, Done in 397 ms · 3 rows (1 row for one row) or Failed in 125 ms. The time is measured in your browser from submit to the end of the run. This is the only place the run status is shown; the Results panel does not repeat it. |
| Save | Opens Save query (see Saved queries). |
| Save as dataset | Opens Save as dataset (see Save a query as a dataset). |
| ⌘K | Opens the command palette. |
| … (More actions) | Explain query, Download CSV (after a successful run), Hide explorer / Show explorer, Command palette…, Keyboard shortcuts. |
When the window is narrow the toolbar wraps onto a second line instead of clipping.

Write SQL
The editor is Monaco, the editor that VS Code uses. It colours SQL, numbers lines, matches brackets and supports the usual editing shortcuts of Monaco (find, undo, comment toggling and so on).
Autocomplete
Suggestions appear as you type, and you can open them at any time with Ctrl Space.
- After
FROMorJOINthe list holds the tables Egret knows about. - After
name.the list holds the columns of the table calledname(for exampleorders.), or the child objects of a catalog or schema (for exampletpch.). - Anywhere else the list starts with the columns of the tables named after
FROMandJOINin your query, followed by tables and SQL keywords.

Autocomplete only knows what the Explorer has already loaded for the current database. To get column suggestions for a table, expand the table in the Explorer once. Switching database resets the list. Table aliases are not resolved: after FROM orders o, typing o. suggests tables, not the columns of orders; type the table name instead.
Format
Format rewrites the whole editor text with one clause per line and two-space indentation. It uses the Trino dialect for Trino connections and the MySQL dialect for StarRocks. Keyword case is kept as you typed it. If the text cannot be parsed, the editor is left unchanged and nothing is reported.
select
orderstatus,
count(*) as n,
sum(totalprice) as total
from
tpch.tiny.orders
where
orderdate > date '1995-01-01'
group by
1
order by
2 desc
Insert names from the Explorer
Clicking a table or column in the Explorer appends its name to the end of the editor text. Egret puts a space in front of it, unless the text is empty or already ends in a space, a line break, an opening parenthesis ( or a dot .. So SELECT * FROM followed by a click on orders gives SELECT * FROM tpch.tiny.orders. Egret never adds a comma: between two column names, type the comma yourself.
Run and cancel
Press Run, or ⌘ Enter (macOS) or Ctrl Enter (Windows and Linux) while the cursor is in the editor.
- One statement per run. Trino accepts a single statement per request.
SELECT 1; SELECT 2fails with a parse error from the engine. A single trailing semicolon after aSELECTis fine. - Run selection. When you select text, the button changes to Run selection and only the selected text is sent. Selecting one statement out of several is the way to run them one at a time. Selected text that is only whitespace is ignored and the whole editor text runs.
- Explain. Explain query in the … menu (and in the command palette) runs
EXPLAINin front of the selection or, with no selection, the whole text, and shows the plan in the grid as one wide cell. Click the cell to read the whole plan in a dialog. - Only one run at a time per tab. Run is disabled while a query is running.
- Cancel. Press Cancel to stop the query. The engine is asked to stop and the run is recorded in History with the status cancelled. The Results panel shows Query cancelled (The run was stopped before it returned rows. Run it again to see results.), and the status badge reads Cancelled after and the time, for example Cancelled after 4.2 s.
- Time out. A query that runs longer than the server's
engine.query_timeout_secs(60 seconds by default) is stopped and fails with timeout: the query ran longer than the 60 s limit for SQL Lab queries and was stopped. The limit is the server settingengine.query_timeout_secs. When Trino stops the query itself at the same limit, its own message (exceeded maximum time limit) is followed by the same hint. When the statement starts withALTER,CREATE,DROP,RENAMEorTRUNCATE(after any comments), both messages add This is a schema change: SQL Lab stopped waiting for it, but the engine may still complete it (a rename can be held while the engines confirm the moved restrictions). Check Governance → Recent changes, or list the tables, before you run it again. SQL Lab only stops waiting: a rename that egret holds while the engines pick up its moved permissions can still go through after the timeout.


Row limit
Limit caps how many rows come back. The default is 1,000 rows. The list offers 10, 100, 1,000, 10,000 and 100,000 rows, and Custom… lets you type any whole number from 1 to 100,000. Larger numbers are clamped to 100,000, and the ceiling is a server setting (engine.max_rows). The limit is remembered per tab.

How the limit is applied depends on the statement:
- A single query (
SELECT,WITH, aUNIONorVALUES) without its ownLIMIT,OFFSETorFETCHgetsLIMIT n + 1added on a new line after your text. YourORDER BYstays the outermost ordering, so the rows come back in the order you asked for, and the error positions the engine reports match the lines in the editor. A trailing semicolon or comment is fine. - A query with its own
LIMIT,OFFSETorFETCHis sent unchanged. - Anything else (for example
SHOW,DESCRIBE,EXPLAIN, or several statements in one text) is sent unchanged. - SQL that Egret cannot read (an engine-specific construct, a
/*!hint or a nested/*comment) but that starts withSELECTorWITHis still wrapped asSELECT * FROM (<your query>) AS _egret_lim LIMIT n + 1. For that SQL anORDER BYwithout its ownLIMITis not guaranteed to be kept on Trino.
In every case Egret stops reading after n rows. When there were more, the Results panel shows the amber chip Results were limited to n rows., so a cut result is always marked. See Query results for how many of those rows the grid loads.
The command palette
Press ⌘ K (macOS) or Ctrl K to open the palette, or press the ⌘K button in the toolbar. The shortcut works with the cursor in the editor too. It is a search box over a flat list of actions; type to narrow the list by name, move with ↑ and ↓, run the highlighted action with Enter and close it with Escape. Pressing the shortcut again closes it.

| Action | What it does |
|---|---|
| Run query / Run selection | Same as Run. |
| Explain query | Same as Explain query in the … menu. |
| Format SQL | Same as Format. |
| Save query… | Opens the Save query dialog. |
| Save as dataset… | Opens the Save as dataset dialog. |
| Hide explorer / Show explorer | Collapses or restores the left panel. |
| Go to Results, Go to History, Go to Saved | Switches the lower panel. There is no entry for Snippets. |
| Keyboard shortcuts | Opens the shortcut list. |
| Download results as CSV | Only listed after a successful run. |
SQL Lab takes ⌘ K / Ctrl K before the editor sees it, so the editor's own shortcuts that start with ⌘ K are not available in SQL Lab.
Keyboard shortcuts
The Keyboard shortcuts dialog (… menu or the palette) lists the shortcuts that Egret defines:
| Action | Keys |
|---|---|
| Run query / selection | ⌘ / Ctrl Enter |
| Command palette | ⌘ / Ctrl K |
| Autocomplete | Ctrl Space |
| Rename tab | Double-click the tab |
| Insert object | Click it in the Explorer |

The Run shortcut belongs to the editor it was pressed in, so it never runs another tab's query.
Limits and known issues
- Autocomplete does not resolve aliases and only knows expanded Explorer nodes.
- On Trino,
ORDER BYwithoutLIMITis not guaranteed to be kept for SQL that Egret cannot read and therefore wraps (see Row limit). - Editor chords that start with ⌘ K are not available (see The command palette).