SQL Execution Plan Reading Guide for a Slow Query
Interpret an explain plan and decide what to try first.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
[VERIFY] is an editorial flag, not a blank to fill. Wherever the prompt shows [VERIFY], check that item against a reliable source before you use it.
Help me read an execution plan. Database system: [DATABASE]. The query: [QUERY]. The plan output as text: [PLAN_TEXT]. Table sizes and existing indexes: [TABLES_AND_INDEXES]. How long it takes and how long it should take: [TIMING]. Explain the plan from the inside out in plain words: which operations happen and in what order, the estimated and actual row counts where shown, and where the time goes. Identify full scans on large tables, joins processing far more rows than expected, sorts that spill, and estimates wrong by a large factor. Suggest changes in order of safety (rewrite the query, add a suitable index, update statistics, reduce selected columns), each with the expected effect and how to test it. Do not recommend an index without understanding the filter and join columns; ask for missing information. Indexes slow writes and use space, so test in a non-production environment [VERIFY]. Method: record the plan and timing before and after, run several times, compare, and stop when the gain is small.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.