Commands Cheat Sheet

Try DrDroid: AI Agent for Debugging

80+ monitoring tool integrations
Long term memory about your stack
Locally run Mac App available

Thankyou for your submission

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

Thank you for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.
Read more
Time to stop copy pasting your errors onto Google!

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;