Good AI Task

AI compatibility

AI can draft the optimization, but a DBA must own the production deployment.

Possible with caveats

Workable, but read the conditions.

Average across 1 submission.

52
avg / 100

The honest read

An AI agent can meaningfully assist with analyzing the T-SQL, suggesting index strategies, restructuring CTEs, and drafting a scheduled job or materialized view pattern — but it cannot safely execute changes against a production database without human review. The error cost is severe (billing data corruption, customer impact), and the agent lacks live access to execution plans, actual schema, and index statistics without explicit provisioning.

Aggregated across 1 submission.

The five dimensions

Repeatability

Medium

Query optimization follows repeatable patterns (index analysis, CTE flattening, temp table staging), but each 1,200-line procedure has unique logic, data distributions, and business rules that require case-specific judgment. This is not a cookie-cutter refactor.

Ambiguity Tolerance

Medium

Some success criteria are measurable (runtime under X minutes, no table locks), but 'optimize' and 'identify bottlenecks' require access to actual execution plans and row statistics that the agent cannot generate without live database access. The agent can propose changes but cannot verify them.

Data & Tool Availability

Low

The agent needs the full T-SQL source, actual execution plans (SET STATISTICS IO/TIME, SSMS plan XML), schema definitions, index metadata, and ideally a non-production environment to test changes — none of which are typically available to an agent without explicit provisioning and permissions.

Error Cost

High

Incorrect query changes on a billing system processing 500K+ records for 200+ enterprise customers can corrupt financial data, produce wrong invoices, or cause extended outages — all of which are costly, partially irreversible, and legally significant.

Human Judgment Required

High

Deciding which optimizations are safe to deploy, whether to restructure business logic vs. just add indexes, and how to stage rollout without disrupting billing cycles requires experienced DBA judgment and organizational context an agent cannot substitute for.

What an agent would need

  • Full T-SQL source code of the stored procedure and all referenced objects (tables, views, functions)
  • Actual SQL Server execution plan XML or SSMS plan files, plus SET STATISTICS IO/TIME output from a recent run
  • Schema definitions including indexes, constraints, and table statistics for all involved tables
  • A non-production SQL Server environment where the agent can test and benchmark proposed changes safely
  • Clear business rules documentation to ensure refactored logic preserves billing accuracy

Best-matched agent type

Code Agent

The kind of agent this work would call for if it were a fit. For this task, it isn't.

Run your own fit check

Get a calibrated read on your specific task in under a minute.

Check a task