SQL Server Blog
Installation | Konfiguration | Optimierung von Microsoft SQL Server
Table Variable Deferred Compilation Disabled! So Why Does SQL Server Still Recompile?
When Microsoft introduced Table Variable Deferred Compilation (TVDC) in SQL Server 2019, table variables finally became capable of generating plans based on actual cardinalities instead of the notorious one-row estimate. If TVDC causes problems, Microsoft provide the...
Interleaved Execution: The Cure for MSTVFs That Never Cured Parameter Sniffing
When Microsoft introduced Interleaved Execution, many SQL Server professionals wondered whether this new optimization technique could eventually help address Parameter Sniffing as well. Instead of compiling a plan based on a fixed cardinality guess, the optimizer...
MSTVFs: Better Estimates, Same Fundamental Problem
For years, SQL Server professionals are using Multi-Statement Table-Valued Functions (MSTVFs). The concept of "reusability" of code originates from high-level programming languages and appears equally attractive for database projects. For this reason, Microsoft SQL...
Update Statistics from Replicated Database
SQL Server transactional replication architecture for offloading statistics maintenance. Statistics are generated on a Subscriber, transferred as STATS_STREAM data through Service Broker, and applied on the Publisher to reduce production workload.
SQL Server Forced Parameterization: When It Improves Performance and When It Doesn’t
Many SQL Server performance tuning discussions focus on indexes, statistics, and query rewrites, while one database option often remains overlooked: FORCED PARAMETERIZATION. In environments flooded with ad hoc queries, SQL Server can spend a surprising amount of time...
Nonfoldable User Defined Functions
Two predicates. One execution plan. Completely different optimizer behavior. Although both expressions return the same value, SQL Server folds one into a constant and treats the other as a runtime calculation. This article explores what happens behind the scenes, how scalar UDFs influence expression folding, and what you can do to make your code optimizer-friendly again.
CTE vs temp table performance in SQL Server. Hidden costs and real workload impact!
Common Table Expressions (CTEs) vs. Temporary Tables is one of those evergreen SQL Server debates. While temp tables often appear faster thanks to better cardinality estimation and materialized statistics, most comparisons overlook an important detail: the hidden cost of creating and populating a temp table. Every temp table introduces overhead through recompilations, tempdb allocation, logging, metadata operations, and sometimes latch contention.
Partition a big table with zero downtime
In this post, I describe how we partitioned a 30‑million‑row table with almost zero downtime by introducing a view, an INSTEAD OF trigger, and a parallelized data‑movement process. This strategy allowed the application to remain fully operational while data was gradually shifted into a partitioned structure.
WHERE 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 point out that it's pointless, while others claim it's either good or...
Table Hint UPDLOCK and LOCK ESCALATION
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?







