How to use the SQL Query Optimizer.
Optimization suggestions need evidence from the schema and execution plan. A shorter query is not automatically faster or equivalent.
Make the workflow fit your task.
Use the schema, indexes and execution plan to identify a measured bottleneck. Propose a bounded change and compare both results and workload performance, accounting for data distribution and write costs.
- What you provide
- Query, schema and supplied execution plan.
- What you get
- Optimization hypotheses with required measurements.
See the input and the result.
Illustrative input and output · a teaching example, not a live WebAct run
Example input
A query filters orders by customer_id; the execution plan scans the full table.
Completed example
Investigate whether an appropriate index improves the measured workload; verify selectivity, write costs and the actual plan before changing production.
Load this input into the prompt, then copy it to WebAct to try the task. Your result may differ from the illustration.
Decisions and troubleshooting.
Is a shorter SQL query necessarily faster?
No. Performance depends on the execution plan and workload. Preserve semantics and measure the relevant behavior after a change.
Why did adding an index fail to improve the query?
Inspect selectivity, predicates and the actual plan. The optimizer may have a valid reason to use a different access path.
Try it with your own source.
Replace the example with your material in the task prompt. Keep the requirements you need, then copy the task into WebAct.
Customize and copy the task ↑