The Query Editor
Running pieces of SQL, reformatting it, and moving around in it.
The query editor holds as much SQL as you like and treats it as a sequence of statements, so you can run one, run a selection, or run everything. This page covers editing and executing queries, see Selected Database / Search Path for how those affect the execution, and Query Results covers what comes back.

Query Editors #
The Query view can hold multiple query editors, each with its own SQL and results. You can also open SQL files into an editor to edit and run them.
Click on the menu to the right of the Queries section header in the sidebar to open a new editor.
Right-click on a query editor in the sidebar to manipulate it directly.

Formatting #
The menu (right-click within the query text view) reformats the selected SQL, or the whole editor when nothing is selected.
| Command | Effect |
|---|---|
| Format | Reformats into a readable layout, using the selected options below. |
| Minify | Collapses to as few characters as possible, using the selected options below. |
| Options | Effect |
|---|---|
| Reindent | Reindents the SQL when enabled. |
| Indent Major Clauses | Indents SELECT, FROM, WHERE, etc as blocks when enabled. |
| Strip Comments | Removes comments when enabled. |
| Keywords → … | Choose a case for SQL keywords. |
| Functions → … | Choose a case for function names, independent of keywords. |
Editing Commands #
| Command | What it does |
|---|---|
| Comment | Comments or uncomments the selected lines. |
| Shift Left, Shift Right | Changes the indentation of the selection. |
| Find…, Find Next, Find Previous, Find and Replace…, Use Selection for Find | The standard find commands, in the menu. |
| Go to Line… | Jumps to a line number. |
| Jump to Selection | Scrolls the selection into view. |
| Next Query, Previous Query | Moves the insertion point between statements. |
Editors and Files #
Each query editor is independent. Switch with and .
An editor can be backed by a file on disk. The execution bar's menu offers:
- Open in New Editor — opens SQL into a new editor.
- Save and Save as SQL File… — write the contents to a file. Once an editor has a file, Save updates it and Revert discards unsaved changes.
- Save as Saved Query… — stores it in Saved Queries instead of on disk.
- Close — closes the editor.
Explaining a Query #
Explain Query shows how the server would run the statement under the cursor, without executing it. Where supported, Querious uses EXPLAIN EXTENDED and follows it with SHOW WARNINGS, which shows how the server rewrote your query and is often more informative than the plan.
To check whether a query uses an index
-
Put the insertion point in the statement and choose from the right-click menu or the statement's marker.
-
On MySQL, read the
typeandkeycolumns for whether an index is used and which.rowsestimates how many rows will be examined. -
If you see a full scan where you expected an index, check Index Usage and the table's Indexes and Keys.
