microsoft / microsoft/go-sqlcmd

Feature: Per-statement timing with -p flag

Open
#621 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
595
Forks
91
Avg merge
9h 35m
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing -p timing path and the timing infrastructure used for :PERFTRACE, then identify where individual statements in a batch are executed. Done means the selected timing mode reports each statement's execution time while preserving the batch total and existing output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
cli, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.