Query editor overview #

The query editor offers a full environment to write and execute SQL statements. You can access all running clusters and their configured catalogs.

Access the query editor at any time by clicking Query editor on the left hand menu. If the left menu is not currently visible, click the button to restore it.

Alternatively, select Query from the options menu in the list of clusters.

Cluster explorer pane #

Use the cluster explorer pane on the left to explore the available clusters and their connected data sources.

cluster explorer

The cluster explorer pane shows an expandable, hierarchical diagram with the following symbols:

clusters cloud symbol
catalogs disks symbol
schemas hub symbol
tables table symbol
views eye symbol
columns two-column table symbol

To expand an element, click its > expanded arrow. To collapse an element, click its v collapsed arrow.

Click a cluster’s name to collapse all catalogs under it. Similarly, click a catalog to collapse all schemas under it, and click a schema to collapse its table list.

Quick info dialogs #

Click or hover over the name of a cluster in the cluster explorer to show a pop-up information dialog that shows the status, size, and region for the selected cluster. For example:

Click cluster name

Click or hover over the name of a table in the cluster explorer to show the full path of the table including cluster name. For example:

Click table name

Vertical ellipsis menus #

The cluster explorer displays a vertical ellipsis menu () on the right of an object’s name when you select or hover over its name. The menu options apply only to the current object. The following example shows the menu for a table:

Three dots for table

The following table shows the menu options provided by the vertical ellipsis menus for the cluster explorer objects.

Object ︙menu options
Select cluster
Sets this cluster as the default for this editor tab.
Copy name to clipboard
Places the quoted catalog name in the clipboard. Example: "tpch"
Select catalog
Sets this catalog as the default for this editor tab.
Copy full path to clipboard
Places the quoted path to this schema in the clipboard. Example: "tpch"."sf1000"
Select schema
Sets this schema and its catalog as the defaults for this editor tab.
Copy full path to clipboard
Places the quoted path to this table in the clipboard. Example: "tpch"."sf1000"."customers"
Enter SELECT * from table LIMIT 10;
Places the statement SELECT * from quoted-table-path LIMIT 10 in the first available line in the editor pane, and selects the line.
Enter DESCRIBE table
Places the statement DESCRIBE quoted-table-path; in the first available editor line and selects the line.
View Same options as for a table, with the word view substituted.
Copy name to clipboard
Places the quoted column name in the clipboard. Example: "custkey"

Editor pane #

Use the editor pane to enter the query you want to execute, then press the ▶ Run button or Ctrl+Enter (⌘+Enter on Mac) to run your query.

Run options #

There are two variations of the Run button, with the last variation you used showing for all tabs. Use the drop-down arrow in the current Run button to select between the two Run options, which are:

  • ▶ Run (limit 1000): This default option retrieves up to 1000 rows of the query’s result set and places it in the results pane. Result sets longer than 1000 rows are truncated as if LIMIT 1000 was appended to the query. While the truncated results are still visible, you can use the Download link at the top of the results pane to download a CSV file of this truncated result set.

  • ▶ Run and download: This option retrieves a query’s entire result set and streams it in CSV format to a file named results.csv in the current user’s default Downloads directory. If a file of that name exists, current results are streamed to results-2.csv and so on. While the download proceeds, a few rows of sample results appear in the results pane. Use this option when you expect a large result set from a query.

If a tab contains more than one SQL statement, you can select one of them and press the Run button of choice. You can also select a portion of a longer SQL statement in a tab and run the selection, as long as it is valid SQL. When text is selected, the Run button options change to:

  • ▶ Run selected (limit 1000)
  • ▶ Run and download selected

Separate query editor tabs #

Organize your queries into separate tabs. For example, with a long-running query active in one tab, use the + button to open another tab for different queries. Rename a tab by double-clicking the tab name. Tab contents and tab names persist across login sessions until the tab is closed.

Query editor tab names

Default location drop-downs #

The right hand corner above the editor pane contains a drop-down selector that lets you specify the default cluster for your queries in the editor. Two more drop-down selectors let you specify a default catalog and schema for those queries. Making these selections is analogous to using the USE command in a SQL client session.

Conversely, if you specify an actual USE catalog.schema statement as an editor command, the specified catalog and schema display as current selections in these drop-downs. However, the format USE cluster.catalog.schema is an invalid command.

Query editor USE buttons

To the right of the three default location drop-downs is a vertical ellipsis menu button with the following options:

  • Copy: to copy the current editor selection to the clipboard.
  • Prettify: to format the selected query to add spaces, tabs, and newlines where needed.
  • Command palette: which opens a dialog from which you can select editing commands to run at the current cursor location or run on the current editor selection. With the cursor in the editor pane, you can also press F1 to open the command palette. Press Esc to close the palette.

Results pane #

The results pane below the editor displays the query processing progress and results. Typically one or more rows and columns are returned by a query.

Select the border between the editor and results panes to drag the results pane up or down.

Query and results panes border

Above the results table on the left, the status bar displays current query processing statistics:

  • Status: displays progress while the query is processed, and final status when complete.
  • Avg. read speed: from all sources, in rows per second.
  • Elapsed time: in seconds since query processing started.
  • Rows: the number of rows returned.

While a query is running, a progress estimate for that query is shown:

Query running stats shown

If your result set is very wide, or is greater than 1000 rows, it is truncated.

Query truncated stats shown

On the right are three active links:

  • Query details: opens the details page for the most recently run query.

  • Web UI: opens the Trino web UI to see information about recently run queries.

  • Download: if results are shown from the last query, initiates download of those results as a CSV file. Results are not stored, and are only available until a new query is run or your page is closed or refreshed, whichever comes first.

Help menu #

The Help (?) menu includes the following convenience links for requesting assistance: