trino-cost-optimization

Analyze Trino query cost drivers using system runtime tables.

14|1|Updated May 5, 2026
One-click install
npx skills add https://github.com/ivanshamaev/de-agent-skills --skill trino-cost-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trino-cost-optimization
Source: https://github.com/ivanshamaev/de-agent-skills/tree/main/group_skills/trino_group_skills/trino_cost_optimization
Command: npx skills add https://github.com/ivanshamaev/de-agent-skills --skill trino-cost-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you control Trino warehouse spending by diagnosing what drives query cost, such as CPU time and physical data scanned, and by applying practical strategies to reduce those drivers.

Core Features & Use Cases

  • Query scan cost analysis: Identifies top expensive queries and operators using Trino system runtime tables (e.g., CPU time and bytes read).
  • Scan reduction and governance: Applies partition-filter requirements and physical scan limits to prevent costly full scans and runaway analyst queries.
  • Storage and worker cost optimization: Uses compaction economics (fewer files/splits), storage retention checks, autoscaling patterns, and spot-instance strategies to lower compute and S3 request costs.
  • Cost attribution and break-even: Estimates total cost using a simple model, supports chargeback reporting, and evaluates materialized view break-even to decide when precomputation pays off.
  • Use Case: When a team’s analytics workload is driving rapidly rising infrastructure bills, use the Skill to attribute spend to teams/users, reduce S3 GET pressure via compaction, and enforce scan limits so expensive queries become rare exceptions rather than the default.

Quick Start

Ask your agent to analyze your last 24 hours of Trino queries by CPU time and bytes scanned, then propose the top three scan-reduction actions (partition pruning, compaction, and scan limits) for the highest-cost tables.

Frequently Asked Questions about trino-cost-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce high Trino query costs from scanning too much data on S3?

To reduce Trino query costs on S3, analyze CPU time and physical bytes scanned using system runtime tables, then apply partition pruning, enforce scan limits, and compact Iceberg tables to cut S3 GET request volume.

What drives compute expenses in a Trino iceberg data warehouse?

Trino compute expenses are driven by CPU time and physical data scanned. You can identify the specific workloads and operators responsible by querying Trino system runtime tables for evidence-based cost attribution.

How do I set up scan limits and partition pruning for runaway analyst queries?

Set up scan limits and partition pruning by applying partition-filter requirements and physical scan limits to prevent costly full scans, ensuring expensive queries become rare exceptions rather than the default.

Can I use spot instances and autoscaling to lower Trino worker costs?

Yes, you can lower Trino worker costs by applying autoscaling patterns and spot-instance strategies. This optimizes compute resources dynamically based on workload demand while reducing overall infrastructure bills.

How do I calculate chargeback reporting and materialized view break-even for Trino?

Calculate chargeback reporting and materialized view break-even by estimating total cost using a simple model. This evaluates when precomputation pays off to decide if materialized views are economically viable.

When should I compact Iceberg tables to reduce S3 request costs?

You should compact Iceberg tables when scan analysis reveals high S3 GET pressure from many small files. Compaction reduces file and split counts, lowering both compute overhead and S3 request costs.