Dashboard

Databases

SQL editor

Browse tables and run read-only queries on a PostgreSQL database from the dashboard.

The SQL editor lets you look at the data in a PostgreSQL database without leaving the dashboard. It only reads: nothing you run in it can change your data.

To open it, go to Databases and click Browse on the database's card. Redis databases don't have one.

Browse tables

The Tables list on the left shows each table with an estimated row count and its number of columns. Type in Filter tables… to narrow a long list.

Click a table to see its rows, 25 to a page:

  • Click a column header to sort by it, and again to reverse the order.
  • Click any cell to copy its value.
  • Empty values show as null. Date and time columns are shown in your browser's time zone.

Selecting a table also puts SELECT * FROM <schema>.<table> LIMIT 100; in the editor, ready to change.

Run a query

  1. Open the SQL editor tab.
  2. Type one statement.
  3. Click Run query, or press Cmd+Enter (Ctrl+Enter on Windows and Linux).

The results table works like the browse view: click a cell to copy it, and Clear empties the results.

What you can run

Each run takes one statement, and it must start with SELECT, WITH, SHOW or EXPLAIN. Anything else, or more than one statement, is refused with:

"Only read-only queries are allowed: run one SELECT, WITH, SHOW or EXPLAIN statement."

The statement runs in a read-only transaction, so a WITH that tries to insert, update or delete fails at the database. Errors from PostgreSQL itself, such as a misspelt table name, are shown as PostgreSQL wrote them.

Two limits apply:

  • A SELECT or WITH query returns at most 500 rows. Add your own LIMIT and OFFSET, or a tighter WHERE, to see a different part of the result.
  • A query can run for up to 15 seconds. A longer one is stopped with "The query took too long and was stopped. Queries in the SQL editor can run for up to 15 seconds." Narrow a slow query rather than retrying it.

To change data, connect with psql or a desktop client through external access, or run the change from your app.

Who can use it

Anyone who can open the project can browse tables and run queries, viewers included. Treat the SQL editor as read access to everything in the database when you decide who to invite. See Roles and permissions.