Recently while working with my client I ended up in a very interesting situation where my client wanted me to write an Efficient Query.
Scan Count Zero in STATISTICS IO: What the Number Means
Scan count zero in STATISTICS IO is not an error and not a free read. This post runs nine small queries and shows what 0, 1, 2 and 5 mean, why a unique lookup counts as zero, and why logical reads are the number to compare.
SET STATISTICS TIME ON – SQL in Sixty Seconds 139
Do you know how long your query took to execution? Well, let us learn that today in SQL in Sixty Seconds. We will discuss SET STATISTICS TIME ON.
Alerting on Long-Running Queries With a SQL Agent Job
Alert on long-running queries with a five-minute SQL Agent job, a deduplicated log, and one Database Mail notice per new request.
Check Constraint on Identity Column: Why Inserts Fail
A check constraint on identity column values can make every insert fail, because the identity moves on whether or not the row is accepted. This post reproduces the failure, shows that the failed attempts still use up identity values, and lists every such constraint in a database with one query.
Single Installer for SSMS and ADS – SQL in Sixty Seconds #138
Microsoft has recently released a single installer which now installs SSMS and ADS both together in a single Installation.
Find Outdated Statistics – SQL in Sixty Seconds #137
Is it possible that your statistics are many years old but still are valid? It is difficult to find Outdated Statistics is not as easy as it seems.
Oldest Statistics in SQL Server: Find the Stale Ones First
To find the oldest statistics in SQL Server, read the last update time and the number of changes since. This post builds a small demo, lists every statistic with its age and percent changed, and shows why a high change count on its own is not a reason to update by hand.










