Home

AI SQL Query Optimizer

Automated pipeline that parses SQL queries into 14 AST features to predict runtime and flag slow queries via a GradientBoosting model.

Stack

Java 17, Spring Boot, FastAPI, React, Docker, GradientBoosting

The Process

Built an automated pipeline that parses SQL queries into 14 AST features (via JSqlParser) and feeds a GradientBoosting model to predict runtime and flag slow queries. It exposes query-rewrite and index recommendations via a FastAPI + Spring Boot REST API, with a Docker Compose deployment.

The Outcome

Achieved R² = 0.86 runtime prediction, 97.8% slow-query classification accuracy, 39.9ms MAE, 0.793 F1 score on classification. Trained on 5,000 synthetic queries.