Mastering the Trino Connection: Unleash the Power of DbVisualizer!


Unlock the potential of Trino and DbVisualizer in our latest blog post. Explore Trino's distributed SQL query capabilities and harness DbVisualizer's intuitive interface for data exploration, visualization, and optimization. Read now to unleash the power of the Trino-DbVisualizer connection!

Tools used in the tutorial
Tool Description Link
trino TRINO
Docker logo DOCKER

In today's data-driven world, organizations face the challenge of handling massive volumes of data across various systems. To extract valuable insights, powerful tools are needed. Enter Trino - an open-source distributed SQL query engine that empowers organizations to process and query large datasets from multiple sources.

But to unleash Trino's full potential, you need a trusty sidekick like DbVisualizer. This superhero of database management and development tools offers a user-friendly interface and a complete platform for working with different databases. DbVisualizer acts as a centralized hub, effortlessly connecting you to Trino and other data stores like Hadoop, Cassandra, and MySQL.

With DbVisualizer, exploring databases, building queries, and visualizing data becomes a breeze. Its query builder tool simplifies query construction, making it easy to manipulate data visually. Moreover, DbVisualizer's data visualization powers are truly impressive, allowing you to create stunning charts, graphs, and dashboards. By connecting DbVisualizer with Trino, you seamlessly blend data from various sources into these visualizations, revealing a world of insights.


  1. Basic knowledge of databases and SQL.
  2. Docker
  3. DbVisualizer

What is Trino?

Trino, formerly known as PrestoSQL, is a powerful open-source distributed SQL query engine designed for large-scale data processing and analysis. It offers a unified interface to query data from various sources, including traditional databases and distributed storage systems. With its distributed architecture, Trino scales horizontally and processes queries in parallel, enabling efficient handling of massive datasets. It supports standard SQL syntax and provides advanced functions for complex data manipulation. Trino can push down query execution to data sources, reducing data movement and improving performance. Widely adopted by organizations, Trino is valued for its flexibility, speed, and ease of use, making it an indispensable tool for data analytics and real-time insights.

What is Trino SQL?

Trino SQL is a powerful language used to query data in Trino, the distributed SQL query engine. It follows the SQL standard and provides a familiar syntax for data analysis tasks. Trino SQL supports a wide range of operations, including querying, filtering, joining, aggregating, and transforming datasets. It includes advanced features such as subqueries and a rich set of functions for data manipulation. Trino SQL leverages the distributed nature of Trino for fast and scalable query execution. It supports various data sources and formats, making it versatile for heterogeneous environments. Overall, Trino SQL offers a robust and efficient solution for querying and analyzing data in Trino.

Setting Up Trino

For this tutorial, we will be running Trino locally on a docker container. Follow these steps to install Trino on your docker container:

Step 1: Pull the Trino Docker Image

The Trino project provides the "trinodb/trino" Docker image, which includes the Trino server and a default configuration. Pull the image from Docker Hub using the following command:

$ docker pull trinodb/trino

This command will download the latest version of the Trino Docker image.

Step 2: Run the Trino Container

Create a container from the Trino image using the following command:

$ docker run --name trino -d -p 8080:8080 trinodb/trino

This command creates a container named "trino" from the "trinodb/trino" image. The container runs in the background and maps the default Trino port, 8080, from inside the container to port 8080 on your workstation.

Step 3: Verify the Container

To verify that the Trino container is running, use the following command:

$ docker ps

This command displays all the running containers. Look for the "trino" container and ensure that it is listed with the appropriate status and port mapping.

Step 4: Wait for Trino to Start

When the Trino container starts, it might take a few moments for it to become fully ready. You can check its status using the following command:

$ docker logs trino

This command displays the container logs. Look for the "health: starting" status initially, and once it becomes ready, it should display "(healthy)".

Congratulations! You have successfully installed Trino on a Docker container. You can now access Trino by visiting http://localhost:8080 in your web browser and start running SQL queries against your Trino cluster.

Setting up the Trino Connection in DbVisualizer

Setting up the Trino connection in DbVisualizer is a straightforward process that allows you to unleash the power of Trino's distributed SQL query capabilities within the user-friendly environment of DbVisualizer. Here's how you can get started:

Now that we have a running Trino database in docker, we can connect DbVisualizer to it by following the steps below:

  1. Go to the Connection tab. Click the "Create a Connection" button to create a new connection.
Creating a database connection in DbVisualizer.
Creating a database connection in DbVisualizer.
  1. Select your server type. For this tutorial, we will be choosing Trino as the driver.
Choosing the driver in DbVisualizer.
Choosing the driver in DbVisualizer.
  1. In the Driver Connection tab, enter the following information:
  • Database server: localhost
    Database Port: 8080
    UseId: “user_name”
Connection Details for the Trino Server in DbVisualizer.
Connection Details for the Trino Server in DbVisualizer.
  1. Click the "Connect" button to test the connection.

If you haven't updated your Trino driver, you will receive a prompt to do so.

Driver download.
Driver download.

Open the Driver Manager tab and update the driver to connect to your Trino database.

Trino download jdbc driver in DbVisulaizer.
Trino download jdbc driver in DbVisulaizer.

Click on “Connect” again to test your connection. If the connection is successful, you should see a message indicating that the connection was established. You can now browse the database using DbVisualizer.

A Message Signifying a Successful Connection.
A Message Signifying a Successful Connection.
  1. Explore and Query Trino Data

With the Trino connection established in DbVisualizer, you are now ready to explore and query your Trino data. Utilize DbVisualizer's intuitive interface, query builder, and visualization tools to interact with Trino and extract valuable insights from your distributed datasets.

The Trino server tree.
The Trino server tree.

Now follow along as we walk you through the CLI capabilities of Trino as well!

Trino CLI

Trino CLI is your go-to command-line buddy for seamless interaction with Trino. The command-line interface allows interaction with Trino, providing capabilities to execute queries, manage connections, and retrieve results directly from your terminal. With its SQL prowess, you can write queries with ease, thanks to nifty features like auto-completion and syntax highlighting. Trino CLI goes the extra mile by allowing you to fine-tune your query experience through configurable session properties and optimized performance options. And guess what? It offers a plethora of output formats to jazz up your query results!

To run Trino CLI on your docker container, use the following command:

$ docker exec -it trino trino

Then enter your Trino SQL query in the terminal and run it to execute the query on your Trino server.

Executing a query in the Trino CLI.
Executing a query in the Trino CLI.

But hold on! There's an exciting alternative that takes your Trino journey to the next level. Imagine stepping into a world of graphical interfaces and advanced visualization wonders. That's where tools like DbVisualizer enter the scene. By harnessing the power of a JDBC driver, you can connect with Trino in DbVisualizer and unlock a universe of interactive exploration, query building, and mind-blowing visualizations. It's like adding a touch of magic to your Trino experience.

So, whether you're a command-line aficionado or prefer the captivating realm of graphical tools, Trino CLI and DbVisualizer offer you the best of both worlds. Get ready to embark on an exhilarating data exploration journey, fueled by the boundless potential of Trino and the seamless connectivity of DbVisualizer.

Executing Queries in DbVisualizer with Trino

DbVisualizer provides a powerful interface for writing and executing SQL queries against Trino. You can leverage its user-friendly query editor to compose SQL statements efficiently. Simply expand the Trino server tree, pick any catalog from the list, and create an SQL query commander by clicking on the play icon with a plus next to it.

The create sql commander button.
The create sql commander button.

You can start writing SQL queries in the SQL commander editor. A good query example is one to count the number of nations in the nation table:

1 select count(*) from tpch.sf1.nation;

Click on the play button above the SQL commander to execute the query. You would get a result as in the image below:

The Trino query result.
The Trino query result.

Now we’ll visualize the queries in Trino with DbVisualizer. Follow along!

Visualizing Trino Queries with DbVisualier

By using SQL, we have the power to create a wide range of analytical queries on this table. For example, let's calculate the average length of the nation names across all regions:

1 SELECT 2 3 regionkey, 4 AVG(LENGTH(name)) AS avg_name_length 5 FROM 6 tpch.sf1.nation 7 GROUP BY 8 regionkey;

The modified query retrieves data from the nations table in Trino and calculates the average length of nation names avg_name_length for each region regionkey. By grouping the results based on the regionkey column, the query provides a summary of the average name length for nations within each specific region.

Running the query above will provide you with the results seen in the table below:

The average nation name query result.
The average nation name query result.

You can use this statistic to create a visualization such as a line chart, bar chart, or area chart. To create a visualization for this table, click on the rightmost button in the result tab toolbar.

The Show as a chart button.
The Show as a chart button.

Then select the values for the x and y axis of your chart by clicking on the select button above the chart panel. Select the avg_name_length as the x-axis and the regionkey as the y-axis.

Setting the chart axis.
Setting the chart axis.

Great! We have successfully created a line chart visualization of our Trino query data.

The Trino Line chart.
The Trino Line chart.

By default, the visualization displays a line chart, but don't let that limit you. Get creative and explore the various customization options available to you. You can try out options like line chart, point chart, area chart, stacked area chart, bar chart, stacked bar chart, and pie chart by clicking on the chart icon above the chart panel to reveal a dropdown menu of various chart types.

The Chart Type Dropdown.
The Chart Type Dropdown.

Impressive, isn't it? DbVisualizer offers a range of customizable features. To explore these options, simply click on the tool button located at the top of the chart tab. From there, you have the freedom to fine-tune your charts according to your preferences. Once you've crafted the ideal chart, it's a breeze to export it as an image – just click on the document icon situated at the top of the chart tab.

Configure chart and export chart button.
Configure chart and export chart button.


In this tutorial, we've uncovered the power of Trino and DbVisualizer by unleashing the capabilities of distributed SQL queries for data analysis. Trino, the open-source SQL query engine, offers the muscle to handle massive data volumes across various systems.

With DbVisualizer as our trusty sidekick, we effortlessly connect to Trino and other data stores. Its user-friendly interface and comprehensive tools make exploring and querying data a breeze.

We've learned how to establish the Trino connection in DbVisualizer, executing SQL queries and retrieving results with ease. But the excitement doesn't stop there!

DbVisualizer's visualization capabilities let us create stunning charts to bring our data to life. We can customize these visualizations to suit our needs, and with a simple click, export them as image masterpieces.

By mastering the Trino connection with DbVisualizer, we can gain valuable insights and supercharge our data analysis. So, don't stop here—explore, experiment, and unlock the full potential of Trino and DbVisualizer using their documentation and blog in your data-driven journey, and until next time!


How do I install Trino on a Docker container?

To install Trino on a Docker container, use the command docker pull trinodb/trino to download the Trino Docker image. Then, create a container from the image using docker run --name trino -d -p 8080:8080 trinodb/trino. Verify the container status with docker ps and ensure it is running.

How do I connect DbVisualizer to Trino?

In DbVisualizer, go to the Connection tab and click "Create a Connection." Choose Trino as the driver and enter the connection details such as localhost for the Database server and 8080 for the Database Port. Click "Connect" to establish the connection.

How can I execute SQL queries in DbVisualizer with Trino?

To execute SQL queries in DbVisualizer with Trino, expand the Trino server tree, create an SQL commander, and write your SQL query in the editor. Click the play button to execute the query and view the results.

How can I visualize Trino queries using DbVisualizer?

DbVisualizer allows you to visualize Trino queries by creating charts. After executing a query, click on the rightmost button in the result tab toolbar to show the chart panel. Select the desired values for the x and y axes, and customize the chart type and appearance as needed.

Can I export the charts created in DbVisualizer as images?

Yes, you can export charts created in DbVisualizer as images. In the chart tab, click on the document icon located at the top to export the chart as an image file.

About the author
Ochuko Onojakpor
Ochuko Onojakpor

Ochuko is a full-stack Python/React software developer and freelance Technical Writer. He spends his free time contributing to open source and tutoring students on programming in collaboration with Google DSC.

The Table Icon
Sign up to receive The Table's roundup
More from the table
Title Author Tags Length Published

SQL STUFF: Insert a String Into Another in SQL Server

author Antonello Zanini tags SQL SERVER 7 min 2024-07-18

SQL Alias: Everything You Need to Know About AS in SQL

author Antonello Zanini tags MySQL ORACLE POSTGRESQL SQL SQL SERVER 7 min 2024-07-15

How to Compare SQL Dates

author Antonello Zanini tags MySQL ORACLE POSTGRESQL SQL SQL SERVER 4 min 2024-07-11

OpenSearch vs. ElasticSearch: What to Choose?

author Lukas Vileikis tags Search 5 min 2024-07-08

REGEXP_MATCH SQL Function: The Complete PostgreSQL Guide

author Antonello Zanini tags POSTGRESQL REGEXP SQL 8 min 2024-07-04

Types of Databases Explained

author Lukas Vileikis tags MySQL 6 min 2024-07-01


author Lukas Vileikis tags MySQL SQL 7 min 2024-06-27

Error: MySQL Shutdown Unexpectedly. Causes & Solutions

author Lukas Vileikis tags MySQL SQL 4 min 2024-06-24

Primary Key vs. Foreign Key: A Complete Comparison

author Lukas Vileikis tags MySQL POSTGRESQL SQL SQL SERVER 7 min 2024-06-20

A Complete Guide to the SQL LIKE Operator

author Antonello Zanini tags MySQL ORACLE POSTGRESQL SQL SQL SERVER 8 min 2024-06-17

The content provided on, including but not limited to code and examples, is intended for educational and informational purposes only. We do not make any warranties or representations of any kind. Read more here.

Cookie policy

We use cookies to ensure that we give you the best experience on our website. However you can change your cookie settings at any time in your browser settings. Please find our cookie policy here ↗