---
name: "trino-distributed-sql-federation"
description: "Query data across Hive, PostgreSQL, MySQL, and Kafka in a single unified distributed SQL query."
metadata:
  author: "Trino"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "join postgres and iceberg trino"
  - "configure trino catalog"
  - "tune trino query memory"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Trino Distributed SQL Query Federation

Configures Trino (formerly PrestoSQL): defining catalogs and connectors, tuning coordinator/worker memory parameters (query.max-memory-per-node), cost-based optimizer (CBO), and analyzing query profiles.

## When to Invoke
Invoke this skill whenever you need to:
- join postgres and iceberg trino
- configure trino catalog
- tune trino query memory

## Execution SOP & Rules
1. Add catalog configuration in etc/catalog/{name}.properties specifying connector.name and connection info.
2. Write federated query: SELECT * FROM postgres.public.users u JOIN iceberg.data.orders o ON u.id = o.user_id.
3. Tune etc/config.properties: query.max-memory = 50GB and query.max-memory-per-node = 8GB.
4. Run EXPLAIN (TYPE DISTRIBUTED) to verify partition pushdowns and join distribution types (replicated vs partitioned).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
