db-berater-server-2

SQL Server Blog

Installation | Konfiguration | Optimierung von Microsoft SQL Server

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...

mehr lesen

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.

mehr lesen

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.

mehr lesen

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.

mehr lesen

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...

mehr lesen