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.
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
- Architecture
- One name, three levels
- From statement to operator
- Why Trino
- In the TDP editions
Watch a query run
Press Play or step through one at a time. Underlined names lead to the Glossary.
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.
In the Glossary: CLI · Drivers · Coordinator
- 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.
- 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.
- 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.
- 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.
- 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.
Architecture
One Coordinator and zero or more Workers form the cluster. Each node runs a single Trino process.
What the figure shows:
- The clients, through JDBC or the CLI, send queries to the Coordinator and receive the responses from it.
- 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.
- 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.
- 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 Glossaryhive— 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.
- Statement. The SQL text that the client sends. When it runs, Trino creates a query and the plan that distributes it across the cluster.
- Query. The distributed plan and everything that executes it: stages, tasks, splits, connectors, and data sources working together to produce the result.
- 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.
- 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.
- 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.
- Operator. Consumes, transforms, and produces data: a table scan fetches data from the connector. A filter returns only what passes the condition.
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.
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
| Edition | Version | Documentation |
|---|---|---|
| TDP Datacenter | 467 | TDP Datacenter components |
| TDP Kubernetes | 478 · chart tdp-trino 3.0.3 | Configuration in TDP Kubernetes |
In TDP Datacenter
In TDP Datacenter, Trino is a stack service, installed and managed by Ambari.
TRINO_CLI (client, one or more), TRINO_COORDINATOR (master, one instance) and TRINO_WORKER (slave, one or more). Component category.
Hive, Iceberg, Delta Lake, Kafka, Druid, and HBase (through Phoenix), in the service's connectors-properties configuration.
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.
tpch and tpcds, with benchmark data. memory, for temporary in-memory tables.
ClickHouse, Kafka, and PostgreSQL: they must be given the environment's endpoints, credentials, and parameters.
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
TDP Datacenter
TDP Datacenter Architecture
Where the Coordinator and the Workers sit in the cluster and what is enabled in Ambari.