query-optimize
Query Optimize
Requirements
Agent: any (read-only analysis) Tools used: sql_optimize, sql_analyze, sql_explain, altimate_core_equivalence, read, glob, schema_inspect, warehouse_list
Analyze SQL queries for performance issues and suggest concrete optimizations including rewritten SQL.
Workflow
-
Get the SQL query -- Either:
- Read SQL from a file path provided by the user
- Accept SQL directly from the conversation
- Read from clipboard or stdin if mentioned
-
Determine the dialect -- Default to
snowflake. If the user specifies a dialect (postgres, bigquery, duckdb, etc.), use that instead. Check the project for warehouse connections usingwarehouse_listif unsure. -
Run the optimizer:
- Call
sql_optimizewith the SQL, dialect, and schema context if available
- Call
More from altimateai/altimate-code
data-viz
>
6schema-migration
Analyze DDL migrations for data loss risks — type narrowing, missing defaults, dropped constraints, breaking column changes. Use before applying schema changes to production.
3dbt-unit-tests
Generate dbt unit tests automatically for any model. Analyzes SQL logic (CASE/WHEN, JOINs, window functions, NULLs), creates type-correct mock inputs from manifest schema, and assembles complete YAML. Use when a user says "generate tests", "add unit tests", "test this model", or "test coverage" for dbt models.
3dbt-test
Add schema tests, unit tests, and data quality checks to dbt models. Use when validating data integrity, adding test definitions to schema.yml, writing unit tests, or practicing test-driven development in dbt. Powered by altimate-dbt.
2dbt-docs
Document dbt models and columns in schema.yml with business context — model descriptions, column definitions, and doc blocks. Use when adding or improving documentation for discoverability. Powered by altimate-dbt.
2sql-review
Pre-merge SQL quality gate — lint 26 anti-patterns, grade readability/performance A-F, validate syntax, and scan for injection threats. Use before committing or reviewing SQL changes.
2