Partition a big table with zero downtime
Today, I came across a post by Michael J. Swart on LinkedIn in which he presented a variation – based on his blog article „Partitioning a Huge Table Quickly“ – of how to implement partitioning with...
View ArticleWHERE 1 = 1 – good practice?
How often do you read on blogs and/or social media platforms that it simplifies work to use „1 = 1“ as the first statement in a WHERE clause, followed by „AND…“ in subsequent lines? Some comments...
View ArticleTable Hint UPDLOCK and LOCK ESCALATION
When using table hints, a few rules should be recommende, which – if ignored – can quickly lead to performance problems. In the database of one of our customer’s software, UPDLOCK is used as a table...
View ArticleAuto Update Statistics and Trivial Execution Plans
Do you know when stale statistics are automatically updated in Microsoft SQL Server? What happens to stale statistics if your queries generate/use trivial execution plans? This article describes how...
View ArticleWhen „Auto Update Statistics“ will not update your statistics
The database option „Auto Update Statistics“ ensures that statistics are automatically updated when a threshold is reached. Under certain conditions, these updated statistics are not considered Why is...
View ArticleIs SWITCH PARTITION a bad idea?
How can SWITCH PARTITION be a bad idea? Do you work with partitioning and know the many advantages that this technology offers? Do you use this technology in DWH to improve workloads or in OLTP...
View ArticlePleasant side effect of EXISTS vs. JOIN
This blog post was inspired by a post by Eric Darling on LinkedIn, where he shared his video on the topic of [NOT] EXISTS. A pleasant side effect of using EXISTS over JOIN concerns automatically...
View ArticleINDEX REBUILD is not FREEPROCCACHE
Do you also think that an INDEX REBUILD triggers a FREEPROCCACHE? Things always get a little quieter between Christmas and New Year and you do things that you don’t have as much time for during the...
View ArticleAutomatically Created Statistics – know the caveats
In the realm of data management, maintaining optimal query performance is paramount. Microsoft SQL Server provides a powerful feature—automatically generated statistics objects—that plays a crucial...
View ArticleTemporary Table or Table Variable, that is the question.
Which technique do you prefer when you create a stored procedure and need to work with temporary data? We know there is no definitive answer to this, but there are workloads where a Table Variable is...
View ArticleAUTO_UPDATE_STATISTICS and thresholds
This week I was called out twice to an incident at a customer’s site where a massive blocking problem occurred in the web shop. The root cause was the AUTO_UPDATE STATISTICS option. One blog article...
View ArticleHelper function for determining the update threshold for statistics
In customer meetings, I am often asked about the formula that Microsoft SQL Server uses to automatically update statistics. I always have to look it up myself because this formula depends on a number...
View ArticlePartitioning and LOCK_ESCALATION = AUTO
Partitioning is, among other things, a great feature when it comes to storing new data in the table as quickly as possible. The locking behavior for the table in particular is a decisive advantage of...
View ArticleThe role of a DBA is NOT Tuning but Operations
You often read on social networks that a DBA’s job is to optimize databases, among other things. I think that’s a misinterpretation of the – important – role of a DBA. Why? I’m happy to share my...
View ArticleForeign Key Constraints – JOIN Elimination
JOIN Elimination in Microsoft SQL Server is an optimization technique with foreign key constraints where the query engine removes redundant JOIN operations during query execution. This occurs when the...
View ArticleForeign Key Constraints – Part II
My first article on using foreign key constraints in databases included the claim that using them slows down an application. This article addresses the claim that a Foreign Key Constraint use locks...
View ArticleUse Foreign Key Constraints in your Databases – Part I
When revising one of my popular sessions on scenarios in which indexes no longer help, one of the topics covered was foreign key constraints for data integrity and JOIN eliminiation. During my...
View ArticleConsider the correct data type in queries
Although an index should provide a fast query, Microsoft SQL Server either does not want to use that index at all or does not want to use it optimally. The cause is not SQL Server or the index but...
View ArticleISNULL() and SARGable queries
Database developers like to use the ISNULL() function to check two conditions and compare them with a search value. This is often done with the intention of finding records that do not have a value...
View ArticleOptimize search for a random key value from a table
Unit tests/demos in workshops and conference sessions sometimes require a random key value from an existing table. In this article I present a solution that accomplishes this task quickly and in a...
View Article