trino

Official

Optimize Trino SQL, query faster.

Authortreasure-data
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill provides expert assistance for writing, analyzing, and optimizing Trino SQL queries for Treasure Data, helping users overcome performance bottlenecks, memory issues, and complex query logic. It ensures efficient data retrieval and processing within the TD environment, saving time and compute resources.

Core Features & Use Cases

  • Performance Optimization: Guides on using time-based partition pruning (TD_INTERVAL, TD_TIME_RANGE), selecting specific columns, and leveraging approximate functions for large datasets.
  • TD-Specific Functions: Explains the effective use of Treasure Data's proprietary SQL functions like TD_INTERVAL, TD_TIME_STRING, and TD_SESSIONIZE for efficient time-series analysis.
  • Query Debugging: Offers insights into common Trino query errors and provides best practices to prevent them, such as avoiding full table scans, leading to more reliable queries.
  • Use Case: A data analyst needs to extract daily active users and their event counts for the last month from a massive event log. This skill helps them write an optimized Trino query using TD_INTERVAL and APPROX_DISTINCT, ensuring the query runs quickly and efficiently without hitting memory limits.

Quick Start

Query daily unique users for the last week

SELECT TD_TIME_STRING(time, 'd!', 'JST') as date, APPROX_DISTINCT(user_id) as unique_users FROM database_name.events WHERE TD_INTERVAL(time, '-1w', 'JST') GROUP BY 1

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: trino
Download link: https://github.com/treasure-data/td-skills/archive/main.zip#trino

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository