Skip to content

Query Engine (Trino)#

The Query Engine in Hopsworks is powered by Trino, a distributed SQL query engine that allows you to run interactive analytics on your data. Use it to explore feature groups, run ad-hoc queries, and analyze data across your project.

Accessing the Query Engine#

Open Queries under Analytics in your project's left sidebar. The page carries four tabs: SQL Runner, Cluster Overview, Catalogs and Queries.

Query Engine
The Query Engine, open on the SQL Runner tab

SQL Runner#

The SQL runner is where you write and execute SQL queries against your data.

To run a query:

  1. Pick a Catalog and a Schema. The tables in that schema are then listed below, and you can write the query against bare table names instead of qualifying every one.
  2. Write the query in the editor, or click a table to start from SELECT * FROM <table>.
  3. Choose a row limit, which is appended to the query as a LIMIT.
  4. Click Run.

Results appear below the editor on two tabs: Results holds the rows, and Table holds the column names and types. The editor auto-completes catalogs, schemas, tables and columns, and Add query opens a second tab so several queries can be kept side by side.

SQL runner
SQL runner

SQL Statement Syntax Help#

Need help with SQL syntax? Click the help icon in the SQL runner to access the complete reference of all allowed SQL statement syntax. This includes SELECT statements, functions, data types, operators, and more. The syntax reference is readily available without leaving the query interface.

SQL statement syntax
SQL statement syntax

Cluster Overview#

The cluster overview reports the query engine's version, environment and uptime, then a tile per metric, each with a sparkline of its recent history:

  • Running queries, Queued queries and Blocked Queries
  • Active workers and Worker Parallelism
  • Runnable drivers, Input Rows/s and Input Bytes/s
  • Reserved Memory

Together they say whether the cluster is busy and whether a slow query is competing for capacity.

cluster overview
Query Engine cluster overview

Managing Catalogs#

The Catalogs tab is where a project makes an external data source queryable from the SQL runner. Creating a catalog from a data source or by hand, referencing credentials, testing the connection, and when a change reaches the query engine are all covered in Trino Catalogs.

Queries#

The Queries tab lists the queries the project has run, filterable by state and sortable, with the query text alongside each entry. A card carries its id and state with a progress bar, the user and source that submitted it, the resource group, its split counts, wall, total and CPU time, and its reserved, peak and cumulative memory. A query that is still running is listed the same way and updates in place.

Click a query id to open its details.

queries
The project’s query history

Query Details#

Clicking on a query opens the detailed view with comprehensive execution information.

Overview#

The overview tab shows query metadata, execution timeline, and performance metrics including:

  • Query text
  • Execution time
  • Data processed
  • Rows returned
  • Resource consumption
Query details
Query details

Live Plan#

The live plan draws the query's stages and the operators inside them, with each stage's state and its CPU time, memory, drivers and tasks, updating while the query runs. The graph is usually taller than the page, so it can be laid out Vertical or Horizontal, panned by dragging, and zoomed by scrolling.

Query details live plan
Query details: live plan

Stage performance#

This view takes one stage at a time, chosen with the Stage selector, and draws its pipelines operator by operator. Each operator reports its throughput, output rows and bytes, driver count, and CPU, wall and blocked time, which is what locates a bottleneck inside a stage rather than merely between stages.

Query details stages
Query details: stage performance

Splits#

Splits show how Trino parallelizes query execution. Each split represents a portion of data processed by a worker. View split-level metrics to understand query parallelism and data distribution.

Query details split
Query details: split

References#

The references tab lists the tables the query read, each with the user it was authorized as and whether the query named it directly, and the routines it called.

Query details references
Query details: references

JSON#

The JSON view provides the complete query execution plan and statistics in JSON format, useful for programmatic analysis or debugging.

Query details json
Query details: json

Best Practices#

  • Limit result sets: Use LIMIT clauses for exploratory queries to reduce resource usage
  • Filter early: Apply WHERE clauses to reduce data scanned
  • Monitor query performance: Check the Queries tab to identify slow or failed queries
  • Use the live plan: For complex queries, review the execution plan to optimize performance
  • Check cluster status: Ensure adequate resources are available before running large queries