Run your first query

Write a SQL query in the Editor, run it, and read the rows it returns. Use this page for your first run, or to see what the Editor shows while a query runs and after it ends.

Before you start

The Editor item appears in the sidebar, and the page opens, only if you have the Execute Query or the Add/Remove Consoles permission. If you cannot see it, ask your administrator to check your role in Roles and permissions.

Your queries are saved in consoles, and only you can see your own consoles. To learn what a console does, see Consoles, saving and history.

Run a query

  1. Open Editor in the sidebar. If you have no open console, the Editor creates one called New Console.
  2. To start another console, click Add Console in the Consoles panel, or press Ctrl+Shift+Q.
  3. Type a query in the editor, for example:
sql
SELECT * FROM <database>."<table>" LIMIT 100

To avoid typing names, point to a database, table or column in the Database Explorer and click Insert into editor.

  1. Run the query in one of these ways:

    • Put the cursor in the statement and click the play button in the toolbar.
    • Put the cursor in the statement, press Ctrl+Enter, and then press Enter to run the highlighted statement.

    On macOS, Cmd+Enter works like Ctrl+Enter.

  2. Read the rows in the Results tab. Use the footer to move between pages. See The data grid for everything the grid can do.

  3. To stop a query that runs too long, click Stop Query, the square icon in the toolbar. It is active only while a query runs.

While a run is in flight, the play button shows Running... and cannot be pressed again. If the run cannot start, the button reads Run blocked, for example until every required parameter has a value.

Choose what runs

You doWhat runs
Click the play button with text selectedExactly the selection
Click the play button with no selectionThe statement at the cursor. If the cursor sits between statements, the nearest one.
Press Ctrl+Enter with text selectedExactly the selection, straight away
Press Ctrl+Enter with no selectionThe statement at the cursor is highlighted and the Statements list opens. Press Enter, or Ctrl+Enter again, to run it.

In the Statements list, press ↑ or ↓ to cycle through the candidates; its footer reads Enter run · ↑↓ choose · Esc cancel. The list offers the statement at the cursor first, then each SELECT subquery that encloses it, from the outermost to the innermost, and then the console's other statements. Typing, clicking elsewhere or leaving the editor cancels the choice.

To run only a subquery, put the cursor inside the brackets around its SELECT, press Ctrl+Enter, press ↓ until the subquery is highlighted, and press Enter.

If your cursor sits after the last semicolon, the last statement runs rather than the whole console.

Watch a query run

While a query runs:

You can switch to another console while a query runs, and you can leave the Editor: the run keeps going on the server. When a run ends in a console you are not viewing, a pulsing dot appears next to its name: blue for success, red for failure. If you return while a run is still going, the Editor reattaches to it; when it ends you see Query completed with "Query finished while you were away", or Query failed with the reason.

Runs are private: only the person who started a run can read its result, stop it, export it or chart it. Each run also adds a row to the console's History tab.

Read the result

On success, the toast Query executed successfully reads Returned N rows in followed by the time the query took on the server. N counts the rows loaded into the first page, which holds up to 1000 rows.

When the result has more than one page, the footer shows the full total as Showing X to Y of Z rows. If the query returns no rows, the grid shows No data available with "This query returned no results". NULL values appear as an italic NULL.

When you return to a console, the Editor fetches its last result again; while that load runs, the Results tab shows Loading results with a Cancel button. With nothing to show yet, it reads No Results Yet with "Execute a query to view results here".

Moving to another page runs the query again for that page. Page sizes and the other grid settings live on The data grid.

When a query fails

Stop a query

Click Stop Query. When the stop works, the toast Query cancelled appears, and the run is not shown as a failed one. If the stop does not work, you see Failed to cancel query.

A cancelled run stays cancelled: a result that arrives late is discarded, and a cancelled run is never reported as failed.

Limits and edge cases

Where to go next

Questions, answered

What exactly runs when I click Run?

The selected text, if you have selected any. Otherwise, the statement where the cursor is.

Why does Ctrl+Enter only highlight my statement?

Ctrl+Enter opens the Statements list so you can check what will run. Press Enter, or Ctrl+Enter again, to run the highlighted statement. If you have selected text, it runs straight away instead.

How do I run only a subquery?

Put the cursor inside the brackets around the SELECT, press Ctrl+Enter, press ↓ until the subquery is highlighted, and press Enter. You can also select the subquery and press Ctrl+Enter.

Why does the toast say 1000 rows when my table is bigger?

The toast counts only the rows loaded into the first page. The footer shows the full total, and you can move between pages to see the rest.

Can I keep working while a long query runs?

Yes. Switch to another console, or leave the Editor: the run continues on the server. A pulsing dot next to the console's name shows when its run ends.

What is the timer at the end of my SQL line?

It counts how long the running statement has been going. It disappears when the run ends; the final time then shows in the toast and in the console's History tab.

How do I send an error to someone?

Click Copy error in the Results tab. The button appears when the database returns the error, and it reads Copied for a moment after you click it.

Why was my console renamed after I ran it?

A console that still has a default name, such as New Console or New Console 1, gets a short name from the AI after its first successful run. If the AI does not suggest a usable name, the name stays. To rename a console yourself, double-click its name. See Consoles, saving and history.

Is a query I stopped shown as a failure?

No. The Editor shows the toast Query cancelled, and a cancelled run is never reported as failed.

Where did my result go when I came back to a console?

The Editor loads the console's last result again from the server, showing Loading results while it works. If the result is no longer there, the Results tab shows No Results Yet. Run the query again to see the rows.