Summary
Add per-statement timing information when using the -p flag, showing execution time for each individual statement in a batch rather than just the batch total.
Use Case
- Identify slow queries within multi-statement batches
- Performance tuning and optimization
- Query profiling during development
Current Behavior
With -p flag, only the total batch execution time is shown:
Network packet size (bytes): 4096
1 xact(s):
Clock Time (ms.): total 150
Proposed Behavior
Show timing for each statement within a batch:
-- Statement 1: SELECT * FROM users
Clock Time (ms.): 45
-- Statement 2: SELECT * FROM orders
Clock Time (ms.): 105
Network packet size (bytes): 4096
2 xact(s):
Clock Time (ms.): total 150
Implementation Notes
- Track timing at the statement level, not just batch level
- Consider making this an optional enhancement to -p (e.g.,
-p2 for verbose timing)
- Leverage existing timing infrastructure used for :PERFTRACE
Summary
Add per-statement timing information when using the
-pflag, showing execution time for each individual statement in a batch rather than just the batch total.Use Case
Current Behavior
With
-pflag, only the total batch execution time is shown:Proposed Behavior
Show timing for each statement within a batch:
Implementation Notes
-p2for verbose timing)