This is a web tool that allows developers and data analysts to:
- Measure SQL query execution time and visualize it with charts
- Analyze execution plan (EXPLAIN)
- Summarize resource usage including EXPLAIN-based estimated rows
- Get optimization suggestions using generative AI(Gemini)
This project is built using Node.js, MySQL, Chart.js, and Gemini AI API.
- Submit a SQL query and see execution time
- Chart visualization
- Displays table access type, keys, rows, and extra info using EXPLAIN in SQL
- Easily view the summary presented in a table
- View comments regarding the plan
- View DB-level metrics like:
- Query Cost (Estimated)
- Handler Read Key
- EXPLAIN Total Estimated Rows
- Ask Gemini to suggest better SQL queries
- Can test this tool by using random queries
- Install dependencies
npm install express body-parser mysql2 dotenv axios
- Set up
.envfile
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=performance_tool_db
GEMINI_API_KEY=your_gemini_api_key
- Download example data and queries
node data/initAdvancedData.js
- Start the server
node server.js
- Open in browser
http://localhost:3000
.
├── README.md
├── data
│ └── initAdvancedData.js
├── db
│ └── index.js
├── package-lock.json
├── package.json
├── public
│ └── index.html
├── routes
│ ├── aiSuggest.js
│ ├── explain.js
│ └── queryTest.js
└── server.js
Contact chole02.han@gmail.com for further questions!
https://velog.io/@jiiiiin02/SQL-Performance-Tool-%EC%A0%9C%EC%9E%91%EA%B8%B0