An AI-assisted SQL performance analysis platform.
Developers often write inefficient SQL queries that lead to slow APIs, high database costs, poor scalability, and performance bottlenecks. QuerySense is an intelligent agent that analyzes SQL queries, detects structural bottlenecks, estimates performance risks, and recommends targeted optimizations before deployment.
Bad queries cost organizations thousands of dollars and degrade user experience. By the time a query bottleneck is discovered in production through traditional profiling, the damage is already done. Identifying missing indexes, redundant joins, or full table scans requires deep DBA expertise that many development teams lack during the active coding phase.
QuerySense shifts database performance analysis left. It acts as a static analysis tool that integrates directly into the developer workflow, catching structural anti-patterns and performance risks without needing direct database execution or populated tables.
Unlike traditional database profiling tools that require executing queries against live data to uncover issues, QuerySense proactively analyzes your code as you write it. It bridges the gap between software engineering and database administration, ensuring that performance optimizations are a core part of the development lifecycle rather than an afterthought.
- Instant Analysis: Paste any SQL query and get a comprehensive, structured breakdown.
- AI Optimization: Identifies missing indexes, redundant joins, and full table scans.
- Visual Diff Comparisons: View side-by-side comparisons of your original query against the optimized version.
- Execution History: Automatically saves analysis results for team review and knowledge sharing.
- Beautiful UI: Highly responsive and intuitive dashboard designed for developer experience.
QueryVision™ is a visual intelligence layer that translates SQL execution plans into an interactive timeline. It dynamically breaks down the sequence of query operations to clarify database behavior. This visualization helps developers pinpoint bottlenecks—such as nested loops or missing indexes—and understand the technical rationale behind each AI-driven optimization.
QuerySense relies on a hybrid rule engine combined with AI analysis. The frontend parses user input and handles syntax highlighting, while the backend utilizes structured LLM outputs via strict Zod schemas to guarantee precise JSON responses.
- Frontend: Next.js 15 (App Router), TypeScript, Tailwind CSS v4, Framer Motion, Monaco Editor
- Backend: Next.js API Routes, Google Gemini API (Structured Outputs)
- Database: Prisma (SQLite local, PostgreSQL ready)
- Input: Paste your raw SQL query into the Monaco-powered editor.
- Analysis: The intelligence engine parses the structure and identifies anti-patterns.
- Recommendation: QuerySense scores the performance risk and generates a heavily optimized query.
- Review: The developer reviews the optimization rationale and applies the updated SQL.
- Code Reviews: Verify SQL queries in PRs to block dangerous or unoptimized code from merging.
- Educational Tool: Help junior developers understand query execution plans and database indexes.
- Pre-Deployment Checks: Ensure queries are performant before they ever reach a staging or production database.
- Clone the repository:
git clone https://github.com/krishna28004/querysense.git - Install dependencies:
npm install - Copy
.env.exampleto.envand add your Gemini API Key. - Setup database:
npx prisma db push - Start dev server:
npm run dev
├── app/ # Next.js app router pages and API
├── components/ # Reusable UI components
├── docs/ # Documentation and architecture decisions
├── prisma/ # Database schema and migrations
└── public/ # Static assets
- QuerySense performs static analysis and does not have access to live database statistics (like table cardinality), meaning recommendations are structural, not empirical.
- Complex dialect-specific features may require manual review.
- Direct integration with GitHub Actions to review PRs automatically.
- Support for live database connections to run actual
EXPLAIN ANALYZEcommands for empirical validation. - Enhanced dialect support for MySQL, SQL Server, and Oracle.
We welcome contributions! Please open an issue or submit a Pull Request. Make sure to follow the existing code style and ensure all type checks pass.
This project is licensed under the MIT License.