SQL Query Tuning Log Worksheet
Tuning without records leads to folklore. This log captures what you changed, the measured before and after, and the percent gain, so you can show what worked and repeat it.
| Query or report | Change made | Before (ms) (ms) | After (ms) (ms) | Reads before | Reads after | Time improvement | Reads improvement | Date | |
|---|---|---|---|---|---|---|---|---|---|
93.2% | 96.1% | ||||||||
83.9% | 88.8% | ||||||||
77.7% | 83.8% | ||||||||
64.4% | 47.4% |
Measure before and after on comparable data and with a warm cache for both runs, or clear it consistently. Logical reads from SET STATISTICS IO are a steadier measure than elapsed time. The example figures are illustrative.
Get a second look at slow queries
Optional: share your top slow queries and we will suggest likely causes and safe fixes.
Optional. The tool and every export work without this. No spam.
How to use the log
Before changing anything, capture elapsed time and logical reads for the query on representative data. Make one change, measure again, and enter both sets of numbers. The worksheet computes the improvement percentage for time and reads, plus an overall time saved figure weighted by total runtime.
Formula and interpretation
Improvement percent equals before minus after, divided by before, times 100. A drop from 18,400 ms to 1,250 ms is about a 93 percent improvement. Compare the time gain with the reads gain: if time fell but reads did not, the gain may come from caching or parallelism rather than a better plan, and it may not hold under load.
- Change one thing at a time
- Use logical reads as the stable metric
- Record the plan operator that changed, such as scan to seek
- Retest after statistics refresh and after data growth
Typical wins on ERP databases
Common causes of slow ERP queries are functions wrapped around indexed columns, such as converting a date column inside the WHERE clause, implicit data type conversions, missing indexes on foreign keys, stale statistics and unbounded date ranges. Document the cause next to each change so the lesson transfers to the next query.
Common mistakes
Adding an index for each slow query can slow inserts and updates on busy transactional tables, and some ERP vendors restrict custom indexes or may overwrite them in upgrades. Check support terms, test on a copy, and keep the log so indexes can be reviewed and removed if they no longer help.
Frequently Asked Questions
Which metric is best for tuning?
Logical reads and CPU time are more repeatable than elapsed time, which varies with load and caching. Record elapsed time too because users feel it, but base decisions on reads and plan changes.
Can I add indexes to a vendor ERP database?
Often yes, but check your vendor support terms first. Some vendors manage indexes themselves or may drop custom ones on upgrade. Document every custom index and plan to retest after upgrades.
How many test runs should I take?
Run at least three times and record a typical value, noting whether the cache was warm. Compare like with like. A single lucky run proves nothing.
What if the improvement is small?
Log it anyway. A change that gave 5 percent and cost an extra index is a useful lesson, and a record stops the same experiment being repeated.
If performance work keeps landing on a few people, we can help you review the slowest queries and set up monitoring that flags regressions after upgrades.
Related Tools
ERP SQL Query Catalog Worksheet
An editable inventory of the queries and reports your team runs, with owner, frequency, runtime and monthly effort.
Developer ToolsScheduled SQL Job Register Worksheet
An editable register of scheduled jobs with daily runtime, dependencies, owners and failure contacts.
ERP OperationsERP Production Data Fix Request Template
A change record for direct data corrections: what is wrong, the exact script, the backup, the rollback and who approved it.
Developer ToolsERP Data Dictionary Worksheet
An editable table to document ERP tables and columns with type, length, null rate, fill rate and owner.
More Developer Tools tools
See all- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
- SAP Quality Notification Pareto SQL Query Generator
- SAP QM Usage Decision BAPI Skeleton
- ABAP Custom Exception Class Generator
- ABAP Unit Test Class Generator