Dev4Snow

Go back to ContentsGo back to previous page

Query History Tab

In this tab you can list the query history from the INFORMATION_SCHEMA (7 days) or from the ACCOUNT_SCHEMA (365 days). Additionally you can add a metric of Warehouse Credits per query that attempts to calculate an approximate value of potential credits spent for running a query.

 

Filters

  • SQL Text (Optional): Enter a substring of a SQL statement to filter by that. By default this filter matching is case-insensitive, but you can force it to make it case-sensitive by selecting the option Case-Sensitive SQL Text next to it.
     
  • Database / Schema (Optional): Select the database –from your list of favorite databases- and then select the schema from the list of populated favorite schemas for that DB. Alternatively manually enter the name of a database or schema –even if they are not in your list of favorites.
     
  • Role Name (Optional): Select the name of a role from the list –only your roles will show up in the list- or alternatively enter the name of any role –even if not in your list.
     
  • Warehouse (Optional): Select the name of a warehouse from the list –only your assigned warehouses will show up in the list- or alternatively enter the name of any warehouse –even if not in your list.
     
  • User (Optional): Enter the name of a user. Matching for this field is case-insensitive.
     
  • Session ID (Optional): Enter a Session ID.
     
  • Query ID (Optional): Enter a Query ID.
     
  • Query Tag (Optional): Enter a Query Tag. Matching for this field is case-insensitive.
     
  • Query Type (Optional): Select the name of a Query Type from the list or alternatively enter the name of any query type –even if not in the list.
     
  • End From / End To (Optional – only available for ACCOUNT_USAGE): Enter the date from/to that is applied as a filter for END_TIME.
     
  • Wh Size (Optional): Select the Warehouse Size from the list.
     
  • Elapsed Time (Optional): Select the elapsed time range from the list.
     
  • Min Scanned Size (Optional): Select the minimum scanned size from the list.
     
  • Min Rows Prod (Optional): Select the minimum number of rows produced by the query from the list.

 

Pre-filters

Pre-Filters are available only when reading from INFORMATION_SCHEMA, and as the name indicates these pre-filters are applied before applying the actual filters –which means it is possible that if you cannot find some data it is because the pre-filters didn’t bring the records that you were looking for. If that’s the case try reducing the pre-filtered records by using the End Date range.

  • End Date (Optional): Select an End Date range from the list.
     
  • History Limit Rows (Mandatory): Select the number of rows that will be scanned to match the query filters.

 

Warehouse credits per query

This feature attempts to provide a metric of how expensive a query execution is. By considering the utilized Warehouse size and the credits per second for that warehouse, and by multiplying it by the elapsed time for a query it calculates a rough measure of potential credits spent. The true Warehouse costs cannot be calculated this way –at query level- since there may be multiple queries running concurrently on a warehouse, unused time that is charged, auto-suspend and the minimum of 60 seconds when resuming. This metric will just provide a value that you could use to compare queries, and to find queries that may be increasing costs.

  • Add column WH_CREDITS: Select this option after reading and understanding how this metric works.

 

Conversions

You can convert some of the columns from the results according to the following flags:

  • Bytes to Megabytes (MBYTES): Convert all columns that are return in bytes to megabytes.
     
  • Rows to Thousand Rows (K-ROWS): Convert all columns that are return in rows to thousand rows.
     
  • Milliseconds to Minutes (MINS): Convert all columns that are return in milliseconds to minutes.