Skip to content

How Trino Works

Trino uses an architecture similar to a classic massively parallel processing (MPP) database management system.

image

Architecture

Trino has one coordinator node working in sync with multiple worker nodes. When you submit a SQL query, the coordinator parses it, builds a distributed query plan, and schedules it across the worker nodes.

Trino supports standard ANSI SQL semantics, including:

  • Complex queries and aggregations
  • Joins (inner, left/right outer joins)
  • Sub-queries and window functions
  • Distinct counts and approximate percentiles

Query Execution

After a query is compiled, Trino processes the request into multiple stages across the worker nodes. All processing is in-memory and pipelined across the network between stages to avoid unnecessary I/O overhead. This enables interactive query performance.

image

Memory Limitations

Trino has a maximum memory limit for each query. If a query requires more memory than the limit, the query will fail. To work within these limits:

  • Use appropriate filtering with TD_TIME_RANGE to reduce data volume
  • Avoid operations that require single-node processing (e.g., ORDER BY, count(distinct))
  • Use CREATE TABLE AS SELECT for large result sets instead of returning results directly

For more information on handling memory errors, see Trino Performance Tuning.