Skip to main content

Run and share queries in the new SQL editor

This page explains how to run queries, share them with collaborators, and edit them together in real time.

Run a single query or multi-statement queries

You can write multi-statement queries into a single editor tab. To use multiple query statements in a single tab, end each statement with a semicolon (;).

To run a single query:

  1. Select a SQL warehouse.
  2. Highlight a query in the SQL editor (if multiple queries are in the query pane).
  3. Press Ctrl/Cmd + Enter or click Run (1000) to display the results as a table in the results pane.
note

By default, Run all statements and Limit 1000 are selected.

  • To run only the active statement, clear Run all statements.
  • If a query is saved with the Limit 1000 setting, this setting applies to all query runs. To return all rows (up to 64,000 rows or 10 MB, whichever is smaller), clear LIMIT 1000 from the Run (1000) drop-down menu. To specify a different limit on the number of rows, add a LIMIT clause in your query.

Terminate a query

To terminate a query while it is running, click Cancel. An administrator can stop an running query that another user started by viewing the Terminate an executing query.

Share a query

The new SQL editor handles permissions in two parts:

Interactive execution: Queries in the new SQL editor always run using Run as viewer credentials. Query results are accessible to anyone who has access to the query. Users with CAN EDIT permissions or higher can modify the shared query draft. Additionally, unsaved edits are visible to anyone with CAN VIEW permissions or higher. Users must have at least CAN USE permission on the associated warehouse to run queries.

Credential settings: The permission settings for legacy alerts and Workflows are the same as those for the legacy SQL editor. Depending on your preferences, these assets can be run using either the owner's or the viewer's credentials.

See Configure query permissions to learn about Run as owner and Run as viewer credential settings. See Query ACLs to learn how to manage access to the query object.

Collaborate on queries in real time

Multiple users editing the same query simultaneously, with each user's cursor and selection highlighted in a different color.

After sharing the query, you can coauthor or debug queries live through collaborative editing. Editors can also comment on individual lines of code to ask questions or add suggestions.