gulliver_top
Identify high-cost repeated queries across query histories, lint top groups, propose same-rows rewrites, and estimate monthly savings without executing or modifying anything.
Instructions
Workload review: the most expensive repeated queries (grouped by shape, literals ignored) from Gulliver's receipts, pg_stat_statements, BigQuery JOBS_BY_PROJECT, Snowflake QUERY_HISTORY or a CSV/JSONL file. For the top ones: lint, a same-rows rewrite and the saving per month (labeled exact or heuristic), plus repeated aggregates worth a summary table. The history query is budget-checked; nothing is run or changed. Use it to find where money goes across many queries; use gulliver_preflight or gulliver_fix for one query.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | History window in days. | |
| path | No | CSV / JSONL / JSON file for source 'file' (absolute path; columns query, calls, bytes, runtime_s, cost_usd). | |
| limit | No | Query groups to return. | |
| source | No | auto (the connection's own history), receipts, pg_stat_statements, bigquery_jobs, snowflake_history or file. | auto |
| analyze | No | How many of the top groups to lint, rewrite and price. 0 only lists them. | |
| dialect | No | Dialect of the SQL in a file. Omit for the connection's. | |
| rank_by | No | auto: cost when known, else runtime. | auto |
| connection | No | Connection name as listed by gulliver_status (from gulliver.toml or GULLIVER_DSN). Omit for the default connection. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||