The SQL editor
Query tabs, running queries, panes, and history.
RED's editor is organized into query tabs - each tab holds its own query and result grid, so you can keep several investigations open side by side. Tabs are reorderable, pinnable, and closable from a right-click menu (Close, Close Others, Close Left / Right, Pin tab) or a middle-click.
Writing a query
The editor completes as you type: tables, columns, and keywords, ranked against
the schema you're connected to. Picking a foreign-key-related table offers the
JOIN clause already written, and an unknown column or table is underlined
inline rather than waiting for the server to reject it. Hover a table or column
name to peek at its definition.
Each statement in the buffer gets a ▶ in the gutter to run that one alone.
| Key | Action |
|---|---|
⌘↵Ctrl+↵ | Run the active tab's query (or just the selection) |
⌥⌘↵Ctrl+Alt+↵ | Run the whole buffer as a script |
⇧⌘ECtrl+Shift+E | Explain the current query and show its plan |
⌥⌘FCtrl+Alt+F | Format (beautify) the SQL in place |
⌘OCtrl+O | Jump to any table or view, matched fuzzily |
⌘FCtrl+F | Find in the query |
⌘↵Ctrl+↵ works from any pane, not only the editor - so you can run again
without leaving the result grid.
Right-click in the editor for Run selection, Explain and Format selection, plus the usual Cut / Copy / Paste / Select All.
Running a script
⌥⌘↵Ctrl+Alt+↵ runs every statement in the buffer in order. Each statement
reports its own outcome in a log beside the editor, a trailing SELECT opens in
the grid, and the run stops at the first failure. Stored routines work as
written: a BEGIN … END body runs as the one statement it is, and
DELIMITER $$ is honoured.
Save and reuse
| Key | Action |
|---|---|
⇧⌘SCtrl+Shift+S | Save the current query as a snippet |
⇧⌘OCtrl+Shift+O | Open a saved query |
Saved queries are plain .sql files, so they're easy to keep in version control
or share.
Panes and tabs
The work area holds any number of panes - as columns, rows, or any nesting of the two. Drag a tab and RED shows exactly where it would land, including the first split of an undivided work area.
| Key | Action |
|---|---|
⌘TCtrl+T | New tab |
⌘WCtrl+W | Close tab (confirms if it holds unsaved work) |
⌃TabCtrl+Tab / ⌃⇧TabCtrl+Shift+Tab | Next / previous tab |
⌘\Ctrl+\ | Split the focused pane right |
⌘⇧\Ctrl+Shift+\ | Split the focused pane down |
⌥⌘\Ctrl+Alt+\ | Focus the next pane |
⌥⌘WCtrl+Alt+W | Close a pane into its neighbour |
⌘⇧↩Ctrl+Shift+↩ | Zoom / restore a pane |
⌥⌘0Ctrl+Alt+0 | Reset every divider to even shares |
Each pane keeps its own tab-strip scroll position and editor/result divider.
History
The history dock (⌘YCtrl+Y) logs what you ran, per connection, with a live
search box and collapsible sections grouped by Today / Yesterday / Earlier.
Click an entry to open it in a new tab, or ⌘Ctrl-click to replace the
current tab's editor. Nothing runs until you run it, so a past write is
never re-executed by a click.
Beyond the editor
These live in the Query menu, the schema panel, and the command palette:
- Watch mode - re-run a tab's read-only query every few seconds, with changed cells flashing, a row-count delta, and the scroll position kept.
- ER diagram - a read-only, pannable and zoomable map of the schema, every table a box and every foreign key a connector. Double-click a table to browse it.
- Show DDL - the definition of any schema-tree object in a read-only, highlighted tab, with Copy and "Open as query". Views, triggers, functions and procedures can be edited from there.
- Schema comparison - diff the current schema against another, with type-aware column matching and additive reconciling DDL generated into a query tab.
- Compare tables - a data diff reporting which rows are added, removed or changed between two tables, aligned by the left table's primary key. Both tables are streamed key-ordered; it never writes.
- Health report - per-engine checks for sizes, unused indexes, missing keys and more, saved per connection.
- Server panel - overview metrics (memory, throughput, connections, replication lag, uptime), live sessions with lock waits marked, and a guarded cancel or terminate. Opens from the status-bar connection chip.
Everything is in the palette
Every discrete action lives in the command palette (⌘KCtrl+K) - a
searchable, phase-aware list of what's actionable right now. The
keyboard reference covers the direct bindings for the
common ones.