Commands Cheat Sheet

Evaluating engineering tools? Get the comparison in Google Sheets

(Perfect for making buy/build decisions or internal reviews.)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Connection

snowsql -a -u -d -s -w
Connect to Snowflake using SnowSQL CLI

USE ROLE
Switch to a specific role

USE DATABASE
Switch to a specific database

USE SCHEMA
Switch to a specific schema

USE WAREHOUSE
Switch to a specific warehouse

Monitoring Queries

SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY())
View recent query history

SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY_BY_USER())
View query history for current user

SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY_BY_SESSION())
View query history for current session

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
View detailed query history with more columns

Warehouse Monitoring

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
View warehouse credit consumption

SHOW WAREHOUSES
List all warehouses

ALTER WAREHOUSE RESUME
Resume a suspended warehouse

ALTER WAREHOUSE SUSPEND
Suspend a warehouse

User Management

SHOW USERS
List all users

SHOW ROLES
List all roles

SHOW GRANTS TO USER
Show grants for a specific user

SHOW GRANTS TO ROLE
Show grants for a specific role

Storage Monitoring

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.TABLE_STORAGE_METRICS
View storage usage by table

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.DATABASE_STORAGE_USAGE_HISTORY
View storage usage history by database

SHOW TABLES
List tables in current schema

DESCRIBE TABLE
Show table structure

Performance Analysis

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE EXECUTION_STATUS = 'FAILED'
Find failed queries

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY ORDER BY EXECUTION_TIME DESC LIMIT 10
Find slowest queries

SELECT * FROM TABLE(INFORMATION_SCHEMA.COMPLETE_TASK_GRAPHS())
View task execution graphs

Data Pipeline Monitoring

SHOW STREAMS
List all streams

SHOW TASKS
List all tasks

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.TASK_HISTORY
View task execution history

SELECT SYSTEM$STREAM_HAS_DATA('..')
Check if stream has data