DATA OPS

On-demand expensive-query triage and rewrite suggestions

When someone flags a costly BigQuery job in Slack, an agent pulls the query and its execution stats, diagnoses why it is expensive, drafts a cheaper rewrite.

CategoryData Ops
Enginepaperclip
Difficultyadvanced
Triggerchat
Steps5
Setup~25 min

How it runs

The automated pipeline, trigger to output.

  • TriggerSlack mention with BigQuery job IDSlack
  • ActionFetch job SQL and execution stats from BigQueryGoogle BigQueryBigQuery
  • ActionAnalyze cost drivers with the modelOpenAI
  • LogicDecide if a rewrite is warranted
  • OutputPost diagnosis and rewrite to the Slack threadSlack

What it does

Triggered by a Slack mention with a BigQuery job ID, an agent fetches the job's SQL and execution metadata, reasons about the cost drivers (full scans, missing partition filters, exploding joins), and produces a plain-language explanation plus a suggested optimized query. It posts the diagnosis and rewrite back into the originating Slack thread and tags the original author.

When to use it

Use this when the data team wants self-serve cost coaching instead of a senior engineer manually reviewing every flagged query. It turns a one-line Slack ping into an actionable optimization writeup the author can act on immediately.

How it works

  1. 1A Slack mention with a job ID triggers the workflow.
  2. 2A BigQuery action retrieves the job's SQL text and execution statistics including bytes billed and referenced tables.
  3. 3The agent analyzes the query and stats to identify the dominant cost drivers.
  4. 4A logic step decides whether a rewrite is warranted or the query is already efficient.
  5. 5The agent drafts an optimized query and a short explanation, then posts it to the Slack thread tagging the author.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect BigQueryDatasets, queries, schemas.
  2. 2
    Connect SlackChannels, DMs, threads, mentions.
  3. 3
    Connect OpenAIModels, embeddings, files.
  4. 4
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  5. 5
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  6. 6
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.