Skip to main content

Ask in SQL.
The answer comes from where the data is.

Trino receives a query, splits the work across several servers, and reads each source where it lives, without copying data. See, step by step, what happens between the question and the answer.

This feature is only available starting from version 2.3.

A distributed query engine runs SQL queries over large volumes of data spread across several sources, right where the data is. In TDP, Trino is the engine that queries several sources in a single statement.

No copies

The data does not move

Analysis happens where the data is stored, in the data lake, the relational database, or the data warehouse. Nothing is duplicated to be queried.

One language

SQL for any source

Analysts write standard SQL. A single statement can join different sources: this is a federated query.

In parallel

Many servers, one answer

Each query is split into smaller tasks, processed at the same time by several nodes of the cluster, and the result comes back consolidated.

On this page

Watch a query run​

Press Play or step through one at a time. Underlined names lead to the Glossary.

ClientWho asks
CLICommand line
DriversJDBC, Python, and others, for applications and BI tools
CoordinatorWho plans
CoordinatorParses, plans, and distributes
WorkersWho executes
WorkerReads its part
WorkerReads its part
WorkerCombines the results
Data sourcesWhere the data is
LakehouseHive and Iceberg tables, catalog in the Hive Metastore
PostgreSQLRelational database
Step 1 of 5

1 The statement reaches the Coordinator

The client, through the command line or a driver such as JDBC or the Python one, sends the SQL statement. Clients talk only to the Coordinator: it receives the question and, in the end, returns the answer.

  1. The statement reaches the Coordinator. The client, through the command line or a driver such as JDBC or the Python one, sends the SQL statement. Clients talk only to the Coordinator: it receives the question and, in the end, returns the answer.
  2. The Coordinator plans. The Coordinator parses the syntax and semantics of the statement, builds the query plan, and splits it into stages, and each stage into tasks.
  3. Tasks go to the Workers. The Coordinator's Scheduler distributes the tasks among the Workers. Each Worker registered with the Coordinator on startup, which is how the Coordinator knows who is available.
  4. Each Worker reads its part. Through the connector of each catalog, the Workers fetch the data directly from the sources and exchange intermediate data with each other. Here the lakehouse and the relational database take part in the same query.
  5. The answer returns to the client. The Coordinator collects the results from the Workers and returns them to the client, which receives a single answer, as if everything were in one database.
Figure 1 - A query in Trino. The client talks only to the Coordinator. The Workers read the sources and exchange data with each other.

Architecture​

One Coordinator and zero or more Workers form the cluster. Each node runs a single Trino process.

Trino architecture: clients, Coordinator, Workers and data sourcesThe JDBC and CLI clients send queries to the Coordinator and receive the responses from it. In the Coordinator, the query goes through the syntactic and semantic analyzer, the planner and optimizer and reaches the Scheduler, which distributes the tasks among the Workers. Two Workers read data from the data sources and send it to a third Worker, which delivers the result to the Coordinator.JDBCCLIClientCoordinatorSyntactic andSemantic AnalyzerPlannerOptimizerSchedulerWorkerWorkerWorkerData SourcesSQL queries and resultsData flowTask distribution by the Scheduler
Figure 2 - Trino architecture: clients, Coordinator, Workers, and data sources. Underlined terms lead to the Glossary.

What the figure shows:

  1. The clients, through JDBC or the CLI, send queries to the Coordinator and receive the responses from it.
  2. The Coordinator is the "brain" of the cluster: it parses, plans, and tracks execution. The query goes through the syntactic and semantic analyzer, the planner and optimizer, and reaches the Scheduler, which distributes the tasks among the Workers. It communicates with clients and Workers through a REST API.
  3. The Workers execute tasks and process data. In the figure, two Workers send the data they read to a third one, which delivers the result to the Coordinator.
  4. The data sources are read by the Workers, which receive the data for each task from them.

In development or testing, a single instance can play both roles.

One name, three levels​

Every table that Trino reaches has a three-part address.

Click each part of the name.

Catalog

A set of properties that gives access to a data source: it states which connector to use, with which credentials and parameters. Several catalogs coexist in the same cluster, which is why a query can join different sources.

See in the Glossary
hive — Catalog
A set of properties that gives access to a data source: it states which connector to use, with which credentials and parameters. Several catalogs coexist in the same cluster, which is why a query can join different sources.
test_data — Schema
Groups tables and other objects within the catalog, like Hive schemas or those of a relational database. Together, catalog and schema define the set of tables that can be queried.
test — Table
Unordered rows, organized into columns with a name and a type. The connector translates the source format into this model.

The connector is the piece that lets Trino talk to each type of source, like a database driver: Hive, Iceberg, PostgreSQL, MySQL, Snowflake, and others. Every catalog points to a connector.

From statement to operator​

What Trino does with the SQL text you wrote: six levels, each inside the other.

Level 1 of 6

Statement

The SQL text that the client sends. When it runs, Trino creates a query and the plan that distributes it across the cluster.

  1. Statement. The SQL text that the client sends. When it runs, Trino creates a query and the plan that distributes it across the cluster.
  2. Query. The distributed plan and everything that executes it: stages, tasks, splits, connectors, and data sources working together to produce the result.
  3. Stage. A section of the distributed plan. Stages form a tree. The root stage aggregates the output of the others. The stage itself does not run on the Workers: tasks do.
    • Exchange. Transfers data between nodes for different stages: tasks write to an output buffer and read from others through an exchange client.
  4. Task. The part of a stage executed on a Worker, in parallel with the other tasks of the same stage. It has inputs and outputs and operates on splits.
    • Split. A segment of a larger data set. The Coordinator tracks all splits and assigns them to tasks according to Worker availability.
  5. Driver. The smallest unit of parallelism: within the task, it combines operators to process the data. A task has one or more drivers in parallel.
  6. Operator. Consumes, transforms, and produces data: a table scan fetches data from the connector. A filter returns only what passes the condition.
Figure 3 - Execution model: each level contains the next. Split and Exchange accompany the task and the stage.

Why Trino​

Speed

Built for interactive analytics

Highly parallel and distributed execution, with sub-second responses in critical scenarios.

Scale

More Workers, more capacity

Adding Workers increases processing capacity, for workloads that reach exabyte scale in large data lakes and data warehouses.

Simplicity

ANSI SQL and BI tools

Compatible with standard SQL, which makes integration easier with tools such as R, Tableau, Power BI, and Superset.

Versatility

Interactive, batch, and high volume

Serves ad hoc analysis, long-running batch queries, and high-volume applications.

Open formats

Parquet, ORC, Avro, JSON, and CSV

Reads the most common data lake formats, and new sources come in through connectors.

Reliability

In critical operations

Used by some of the largest organizations in the world in operations such as financial reporting for public markets.

Where the name comes from

Trino started as Presto, created by Facebook engineers for the company's internal data analysis. In 2020, after a split with the Presto Foundation, the project continued as Trino, now maintained by the Trino Software Foundation, a non-profit organization. The engine is written in Java.

In the TDP editions​

Available in the TDP editions
EditionVersionDocumentation
TDP Datacenter467TDP Datacenter components
TDP Kubernetes478 · chart tdp-trino 3.0.3Configuration in TDP Kubernetes

In TDP Datacenter​

In TDP Datacenter, Trino is a stack service, installed and managed by Ambari.

Service components

TRINO_CLI (client, one or more), TRINO_COORDINATOR (master, one instance) and TRINO_WORKER (slave, one or more). Component category.

Connectors that can be enabled in Ambari

Hive, Iceberg, Delta Lake, Kafka, Druid, and HBase (through Phoenix), in the service's connectors-properties configuration.

Authorization

The Ranger plugin for Trino can be enabled in the service configuration. See Security in TDP Datacenter.

In TDP Kubernetes​

In TDP Kubernetes, Trino is installed by the tdp-trino chart, and catalogs are defined in tdp-trino.catalogs.

Catalogs enabled by default

tpch and tpcds, with benchmark data. memory, for temporary in-memory tables.

Examples that require configuration

ClickHouse, Kafka, and PostgreSQL: they must be given the environment's endpoints, credentials, and parameters.

Lakehouse integration

Hive and Iceberg, with the Hive Metastore as catalog and S3-compatible storage.

In both editions, what makes a source queryable is the catalog that describes it: the connector to use and the connection parameters for that source.

In TDP Kubernetes, this is an entry in tdp-trino.catalogs. In TDP Datacenter, it is the connector enabled in connectors-properties, in the Trino service in Ambari.

Next steps​

Sources​

Trino - Overview