- ANALYSIS
- VALIDATION
- OPTIMIZATION
- HUMAN
Short answer
How can I use AI to find slow GraphQL queries?
Your agent uses Hasura to run specific queries and pull their SQL execution plans. It then analyzes those plans to identify missing indexes or inefficient joins. You get a clear breakdown of where the database is struggling.
The results.
Where your performance data lands.
The AI processes your Hasura data into these specific outcomes.
ANALYSIS
Execution plan insights
The agent uses explain_graphql to pull the SQL plan. You get a plain English explanation of why a query is slow.
VALIDATION
Query testing results
The agent runs execute_graphql to verify if a fix actually works. You see the real-time response from your Hasura engine.
OPTIMIZATION
Index recommendations
By looking at the scan types in the execution plan, the agent suggests which columns need new indexes to stop full table scans.
HUMAN
Manual schema changes
The AI identifies the problem, but you must apply the actual SQL migrations or index changes in Hasura. The agent cannot modify your database schema.
The workflow
What your AI does when a slow query is reported.
The agent moves from identifying the query to analyzing the database behavior.
Fetch the query
The agent pulls the specific GraphQL query you are worried about to understand its structure.
execute_graphqlInspect the plan
It requests the underlying SQL execution plan from Hasura to see how the database handles the request.
explain_graphqlIdentify bottlenecks
The agent compares the query structure against the execution plan to find slow joins or unindexed scans.
explain_graphqlVerify the fix
Once you propose a change, the agent runs the query again to confirm the performance improvement.
execute_graphql
Try it
Copy these to start.
Use these prompts to kick off a debugging session.
Starting points
Swap out the bracketed text with your actual GraphQL query or table names.
Hasura Connector
You're all set. Choose your MCP client and follow the setup instructions.
https://edge.vinkius.com/vk_preview_Q19k5WrSMOV2zDZs6DlIbmRJGyWfSnbLHJlhJLmt/mcpClaude Desktop
Follow the steps below to connect in seconds.
- 1In Claude Desktop, open Settings → Connectors.
- 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
- 3Click Add and start a new chat — Hasura capabilities are ready to use.
{
"mcpServers": {
"hasura-instant-graphql-rest-engine-mcp": {
"url": "https://edge.vinkius.com/vk_preview_Q19k5WrSMOV2zDZs6DlIbmRJGyWfSnbLHJlhJLmt/mcp"
}
}
}Run the GraphQL query {query} and explain why it might be slow.
Get the execution plan for this query: {query}.
Analyze the execution plan for the query on the users table and check for missing indexes.
Compare the performance of this query {query} before and after I suggest an index change.
Claude
ChatGPT
Cursor
VS Code
Windsurf
Claude Code
JetBrains
Cline
Start here
Connect Hasura once, then ask.
Just provide your Hasura endpoint. Your credentials stay encrypted, and you can immediately start debugging with your agent.
Connect Hasura to your AIFAQ
How this task behaves.
- 01
Can the AI change my database schema?
No. The agent can only read data and execution plans. You have to run the actual migrations yourself.
- 02
Does the AI delete any data in Hasura?
No. The tools provided are for executing queries and explaining plans; they do not include tools for deleting or dropping tables.
- 03
Can it find slow queries automatically?
No. You need to provide the specific query or the table you are investigating so the agent knows what to analyze.
- 04
Will it fix my slow joins?
It will identify that a join is slow and suggest a fix, but it cannot rewrite your database or add the indexes for you.
- 05
How does it know why a query is slow?
It uses the explain_graphql tool to look at the SQL execution plan, which shows how the database engine is actually processing the request.
More questions about Hasura? See everything the Hasura Connector can do
Connect Hasura to Claude, Cursor, ChatGPT & more
