aiops-query-cost-analyzer

Analyze Trino and ClickHouse query history to estimate and attribute data-warehouse costs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you identify which data queries are driving the largest compute and data-scan costs and then reduce those costs with actionable optimization guidance.

Core Features & Use Cases

  • Cross-engine cost attribution: Analyzes Trino, ClickHouse, and (via provided logic) Spark cost signals using engine system tables/logs.
  • Expensive-query ranking & budget enforcement: Surfaces top resource-consuming queries, estimates cost proxies, and flags users exceeding daily budgets.
  • LLM-driven rewrite recommendations: Generates targeted SQL rewrite suggestions for common cost drivers such as missing partition filters, inefficient aggregation, and join strategy issues.
  • Chargeback & anomaly reporting: Produces team/project chargeback summaries and detects anomalous cost regressions over time.

Quick Start

Use the aiops-query-cost-analyzer skill to generate a cost report for your last 24 hours of Trino and ClickHouse queries, including the top expensive queries and suggested SQL rewrites.

Frequently Asked Questions about aiops-query-cost-analyzer

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

FAQPage Schema
How do I analyze Trino query costs and identify expensive SQL workloads?

To analyze Trino query costs, you need to process engine system tables and logs to compute cost proxies from CPU time, memory usage, and bytes scanned, which surfaces top resource-consuming queries for optimization.

How does query cost attribution work for ClickHouse chargeback reporting?

Query cost attribution for ClickHouse chargeback works by reading engine system logs to estimate compute and data-scan costs, producing team and project summaries based on resource consumption metrics.

Can I get SQL rewrite recommendations to reduce data warehouse query waste?

Yes, you can get LLM-assisted SQL rewrite recommendations to reduce data warehouse query waste by targeting common cost drivers like missing partition filters, inefficient aggregation, and suboptimal join strategies.

What's the best way to enforce daily query budgets and detect cost anomalies?

The best way to enforce daily query budgets and detect cost anomalies is to estimate cost proxies from query execution history, flag users exceeding limits, and monitor for expensive recurring SQL regressions over time.

Does this query cost analysis approach support Spark workloads alongside Trino and ClickHouse?

Yes, this query cost analysis approach supports Spark workloads alongside Trino and ClickHouse by applying provided logic to extract and process cost signals from Spark engine system tables.

Why are my Trino queries so expensive and how do I find the root cause?

Your Trino queries are expensive due to high CPU time, memory usage, or bytes scanned, and you can find the root cause by ranking resource-consuming queries and tagging issues like missing partition filters.