The MERGE statement was introduced in SQL Server 2008 and the developers embraced it immediately. Later a feedback came and the statement was criticized as not very efficient. Aaron Bertrand collected some links about this here. MERGE statement anatomy The MERGE statement joins ‘source’ and ‘target’ tables and runs INSERT, […]
Optimization
Set-based Database Development As database developer, we need to switch our mindsets to “Set-based thinking”. In simple words we need to manipulate the data as a “set”. An example of set-based database development is: JOIN tables Aggregate the result Calculate the portion (%) of a row to the total of […]
There is a great news today for SQL Server community – SQL Sentry (RSS: SQLPerformance.COM) Plan Explorer is FREE for everyone. Download User Guide Thank you, SQL Sentry! Keep it simple :-)
In this example I will compare the execution of two possible options to aggregate multiple columns. I have data columns A, B and C and I need to show the average. “CASE” is using a formula ((A + B + C) / (1, 2 or 3)), simulating the scenarios when […]