Examine SQL queries (Workbooks)

Sigma’s Query history modal is a powerful tool if you want to better understand your Sigma generated SQL queries.

The modal displays an overview of recent queries, their runtime and current status. You can deep dive into individual queries to view their underlying SQL or investigate errors.

View recent queries

The query history modal displays recent queries run from your open document within the existing session.
Your document’s individual query list will automatically show each query’s status, action type, start time and run time.

  1. Click the caret (▼) button next to the refresh data button in the workbook's header.
  2. Click Query history.
    Screen_Shot_2022-02-10_at_8.57.20_AM.png

View an individual query

  1. Click the caret (▼) button next to the refresh data icon button in the workbook's header.
  2. Click Query history....
    Screen_Shot_2022-02-10_at_8.57.20_AM.png
  3. Click the query you plan to examine.
    Screenshot 2023-07-30 at 7.58.41 PM.png
  4. Explore the query detail view:
    • View and copy the Sigma generated SQL.
    • If the query failed, an error will also be displayed below Query Details.
      Screenshot 2023-07-30 at 9.06.31 PM.png

View browser calculations

  1. Click the caret (▼) button next to the refresh data icon button in the workbook's header.
  2. Click Query history....
    Screen_Shot_2022-02-10_at_8.57.20_AM.png
  3. Enable the View browser calculations setting at the top of the Query history modal. Browser calculations are identified in the Execution Path column.
    Screenshot 2023-07-30 at 7.58.41 PM.png
    Sigma maintains a cache of recent results in the web browser. This does not apply on the initial load of the workbook since the cache is empty, however, as changes are made in the workbook, it is automatically leveraged. 
    If Sigma determines that there is enough data in the browser cache to support new visualizations and queries, Sigma does not issue a network request. In other words, Sigma leverages the browser cache to perform new calculations instead of sending new queries to the database for computation. For example, when a user creates a new calculation such as a percentage change ([column 2] - [column 1])/[column 1].

Query status types

These are the possible query status types within Sigma:

completed   Completed

Your query ran successfully!

running   Running

Your query is running currently.

By default, Sigma sets query timeouts to 120 seconds (2 minutes). Organization admins have the option to customize this per connection.

error   Errored

Something is wrong.

Open the query detail view to see the error message.

paused   Paused

Queries on your document are paused.

To restart queries, click Play in your document toolbar.

–   Canceled

The query is canceled.

This may happen if additional changes are made to your document before the query runs. In this situation, Sigma runs the new query only.

Query runtime breakdown

A detailed query runtime breakdown is available for successfully completed and timed out queries. Query runtimes can vary due to network traffic, queue delay, or data warehouse processing time. Sigma’s runtime breakdown allows you to see if and when your query encountered delays.

The runtime is broken into three parts:

Queue duration

The amount of time the query sits in Sigma’s queue before being sent to the warehouse.

Sigma runtime

The amount of time Sigma takes to process the query, excluding queue duration and warehouse time.

Warehouse runtime

The amount of time between when Sigma sends a request to your data warehouse and when it gets a response back. This is roughly the amount of time the warehouse spent running your query.

Incomplete queries do not display a detailed runtime breakdown. This feature is also not available for download/export requests.

Pause and Resume Queries

You can pause queries to make changes to your document without automatically running queries against your warehouse.

  1. Click the caret icon next to the refresh/play button all the way to the left in your dataset’s toolbar.
  2. Click Pause queries or Resume queries.
    Screen_Shot_2022-02-10_at_9.01.00_AM.png

Related resources