T-SQL bugs, pitfalls, and best practices – window functions
This article is the fourth installment in a series about T-SQL bugs, pitfalls and best practices. Previously I covered determinism, subqueries and joins. The focus of this month's article is bugs,...
View ArticleBatch Mode Bitmaps in SQL Server
Background In traditional row-mode execution plans, SQL Server may introduce a Bitmap operator as part of performing early semi join reduction before a parallel hash or merge join. The bitmap is...
View ArticleAMD EPYC 7002 Series Processors and SQL Server
On August 7, 2019, AMD finally unveiled their new 7nm EPYC 7002 Series of server processors, formerly code-named "Rome" at the AMD EPYC Horizon Event in San Francisco. This is the second generation...
View ArticleBatch Mode Normalization and Performance
I briefly mentioned that batch mode data is normalized in my last article Batch Mode Bitmaps in SQL Server. All data in a batch is represented by an eight-byte value in this particular normalized...
View ArticleT-SQL bugs, pitfalls, and best practices – pivoting and unpivoting
This article is the fifth part in a series about T-SQL bugs, pitfalls and best practices. Previously I covered determinism, subqueries, joins, and windowing. This month, I cover pivoting and...
View ArticleTuning SQL Server Reporting Services
Many database administrators find themselves having to support instances of SQL Server Reporting Services (SSRS), or at least the backend databases that are required for SSRS. For years SSRS was...
View ArticleNested Loops Joins and Performance Spools
Introduction Performance spools are lazy spools added by the optimizer to reduce the estimated cost of the inner side of nested loops joins. They come in three varieties: Lazy Table Spool, Lazy Index...
View ArticleOverlooked T-SQL Gems
My good friend Aaron Bertrand inspired me to write this article. He reminded me of how sometimes we take things for granted when they seem obvious to us and don't always bother checking the full story...
View ArticleUnderstanding Event Loss with Extended Events
My colleague, Erin Stellato, recently asked me a question about where and why event loss could happen with Extended Events. The question was the result of a comment someone had made on one of her blog...
View ArticleAnalyzing "death by a thousand cuts" workloads
There are multiple methods to look at poorly performing queries in SQL Server, notably Query Store, Extended Events, and dynamic management views (DMVs). Each option has pros and cons. Extended Events...
View ArticleRow numbers with nondeterministic order
The ROW_NUMBER window function has numerous practical applications, well beyond just the obvious ranking needs. Most of the time, when you compute row numbers, you need to compute them based on some...
View ArticleThe Importance of Selecting the Proper Azure VM Size
Migrating an on-premises SQL Server instance to an Azure Virtual Machine (VM) is a common method to migrate to Azure. IT professionals are familiar with scoping the size of VMs with regards to vCPU,...
View ArticleThe Eager Index Spool and The Optimizer
Introduction An Eager Index Spool reads all rows from its child operator into an indexed worktable, before it starts returning rows to its parent operator. In some respects, an eager index spool is the...
View ArticleAzure Virtual Machines for SQL Server Usage
One initial, easy step to moving your SQL Server on-premises workloads to the cloud is using Azure VMs to run your SQL Server workloads in an infrastructure as a service (IaaS) scenario. This removes...
View ArticleFun with (columnstore) compression on a very large table – part 1
Recently someone at work asked for more space to accommodate a rapidly growing table. At the time it had 3.75 billion rows, presented on 143 million pages, and occupying ~1.14TB. Of course we can...
View ArticleFun with (columnstore) compression on a very large table – part 2
In part 1, I showed how both page and columnstore compression could reduce the size of a 1TB table by 80% or more. While I was impressed I could shrink a table from 1TB to 50GB, I wasn't very happy...
View ArticleWhy Wait Stats Alone Are Not Enough
"Waitstats helps us identify performance-related counters. But waits information by itself isn't enough to accurately diagnose performance problems. The queues component of our methodology comes from...
View ArticleFinding Distinct Values Quickly
Back in 2014, I wrote an article called Performance Tuning the Whole Query Plan. It looked at ways to find a relatively small number of distinct values from a moderately large dataset, and concluded...
View ArticleBandwidth-friendly Query Profiling for Azure SQL Database
SQL Server has always provided the ability to capture live queries on an ad hoc basis in an easily-consumable rowset format – first with legacy SQL Server Profiler, later via Extended Events in SSMS....
View ArticleNew Metadata-Only Column Changes in SQL Server 2016
The ALTER TABLE ... ALTER COLUMN command is very powerful. You can use it to change a column's data type, length, precision, scale, nullability, collation…and many other things besides. It is certainly...
View Article