Query sys.dm_db_stats_histogram to inspect statistics steps, compare stored estimates with data, and identify values beyond the last step.
SQL SERVER – Alternative to DBCC INPUTBUFFER – sys.dm_exec_input_buffer
DBCC INPUTBUFFER shows very little. In SQL Server 2016, the new sys.dm_exec_input_buffer function gives far more details about the last statement sent.
Wait Stats Collection Script for Current SQL Server Versions
A wait stats collection script saves snapshots of sys.dm_os_wait_stats into a table, so you can compare two snapshots instead of reading totals since the last restart. This post builds the tables and a snapshot procedure, creates a small load, and reports the change with a category for each wait. It also covers idle waits, restarts and retention.
SQL SERVER – Get Wait Stats Related to Specific Session ID With sys.dm_exec_session_wait_stats
From SQL Server 2016, sys.dm_exec_session_wait_stats shows wait stats for a specific session ID. Here is how to use it, and why it fails on older versions.
SPID, KPID and ECID in sys.sysprocesses: What They Mean
SPID, KPID and ECID are the three ID columns of sys.sysprocesses: the session, the Windows thread and the part of a parallel query. This post reads them for an idle session and for a query running in parallel, explains why KPID can be negative, and names the DMVs that give the same answers today.
SQL SERVER – Observation – Adding a NULL Column and Table Space
Does adding a NULL Column with no default make a table bigger? Usually not. A reader’s question and a practical example that measures it.
SQL SERVER – How to Find Row Count of Every Table in Database Efficiently?
How do you find the row count of every table in a database without a cursor? An interview question, answered with a fast query instead of a loop.






