Skip to content

feat: evaluate rewrite costs and promote optimization state#104

Open
veksen wants to merge 1 commit intomainfrom
veksen/feat-rewrite-cost-eval
Open

feat: evaluate rewrite costs and promote optimization state#104
veksen wants to merge 1 commit intomainfrom
veksen/feat-rewrite-cost-eval

Conversation

@veksen
Copy link
Copy Markdown
Member

@veksen veksen commented Mar 31, 2026

Summary

  • Evaluate rewrite costs against the real PostgreSQL after optimization completes
  • Format rewritten queries with prettier for clean display in the UI
  • Promote optimization state from no_improvement_found to improvements_available when a rewrite has significant cost savings
  • Uses evaluateNudgeRewriteCosts and bestRewriteImprovement from @query-doctor/core

Dependencies

Requires @query-doctor/core >= 0.6.0 with the rewrite cost evaluation module.

Companion PR: https://github.com/Query-Doctor/Site/pull/2666

Test plan

  • Connect to a database with NOT IN queries, verify "improvements available" status and cost reduction % shown
  • Verify rewrite query is formatted with proper SQL keywords (uppercase)
  • Verify queries without rewrites are unaffected

🤖 Generated with Claude Code

After optimization, evaluate rewrite costs for nudges that have AST
rewrites attached. Format rewritten queries with prettier. Promote
optimization state from no_improvement_found to improvements_available
when a rewrite has significant cost savings.

Depends on @query-doctor/core >= 0.6.0 (evaluateNudgeRewriteCosts,
bestRewriteImprovement).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant