Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool

For a slow query, rewrite it first or add an index first?

For a slow SQL statement, read the execution plan first to find the full table scans, then decide whether to add an index or rewrite the query. After the change you must compare timings before and after; judging by feel whether an optimization worked usually falls flat.

Diagnosis Software and engineering 💻 Code Time: About 30 minutes Cost: Free 5 steps
1
Export the table structures and row counts involved in the slow query into a table, mark which one is the big table, and gauge the scan scale first
Cost: Free to start
Alternatives: WPS AI · Shimo Docs AI
2
Paste the SQL and the execution plan, have it point out the rows with type ALL and the missing indexes, sorted by impact
Cost: Free
Alternatives: Kimi Moonshot AI · Qwen
3
Rewrite the SQL or add the index statement as suggested, run it on the test database, and record the before-and-after timings
Cost: Free to start
Alternatives: Github Copilot · Qwen Lingma
4
Have the AI compare the execution plans before and after the rewrite to confirm no temp tables or extra sorts appeared
Cost: Free
5
Save the before-and-after timings and execution plan screenshots to the performance log page, noting the test database's row counts for later reference
Cost: Free
Alternatives: Feishu · Shimo Docs AI
Common misreads Adding an index without reading the execution plan, which makes writes slower instead.
Trying the change directly on the production database, where table locks hit the business.
Timing it only once and mistaking a cache hit for a successful optimization.
Putting the index on a low-cardinality column, so the query doesn't get faster.

More playbooks

All playbooks
Checklist Time: About 1 day On a price schedule, do I submit as soon as it's calculated or check it three times before stamping? The line items, tax rate, freight and total must all add up. First check whether tax-inclusive and tax-exclusive prices are mixed in the sheet, then cross-check, and deliver a price schedule you can stamp and submit. Manufacturing and export Decision guide Time: About 1 day On a technical deviation table, should I mark everything as no deviation or state each item honestly? If acceptance fails after you win, it's usually because the deviation table promised too much. Compare the tender's technical parameters with your product line by line, mark positive deviation, negative deviation or no deviation honestly, and first define which negative deviations are acceptable. Manufacturing and export Checklist Time: About half a day For a qualification compliance table, do I fill in the evidence first or check the commitment letters first? Fill in your own evidence and page numbers after each row so gaps are obvious at a glance. First check which clauses allow a commitment letter in place of supporting documents, then finalize the evidence list. Deliverable: one qualification compliance table you can hand straight to the bid team. Manufacturing and export Step-by-step flow Time: About 2 days For a new warehouse SOP, should I make a flowchart or a screenshot-based course? The SOP is only really done when a new hire can go through the course and start working. Cover the five steps - receiving, putaway, picking, checking and shipping - each with screenshots, and state in each step what counts as done right. Deliverable: one training course you can teach straight from. Logistics and supply chain