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

Connect to server
trino --server : --catalog --schema

Connect with authentication
trino --server : --user --catalog --schema

Connect with specific resource group
trino --server : --catalog --schema --resource-group

Connect with JDBC URL
jdbc:trino://://

Basic Queries

Show catalogs
SHOW CATALOGS;

Show schemas
SHOW SCHEMAS [FROM ];

Show tables
SHOW TABLES [FROM .];

Show columns
SHOW COLUMNS FROM ;

Describe table
DESCRIBE ..;

Query Execution

Run query
SELECT * FROM .. [WHERE ...] [LIMIT ];

Run explain
EXPLAIN SELECT * FROM ;

Analyze query
EXPLAIN ANALYZE SELECT * FROM ;

Cancel query
Ctrl+C (in CLI) or use web UI

Monitoring

Show running queries
SELECT query_id, user, state, queued_time, elapsed_time FROM system.runtime.queries;

Show completed queries
SELECT query_id, user, state, total_cpu_time FROM system.runtime.completed_queries;

Kill query
CALL system.runtime.kill_query(query_id => '');

Performance

Show query stats
SELECT * FROM system.runtime.query_stats;

Show worker stats
SELECT * FROM system.runtime.nodes;

Show memory usage
SELECT * FROM system.memory.node_memory_pool_info;