We looked at a couple examples of when SQL Server might need to filter out rows later in the plan than we’d like, and why that can cause performance…
Read the post: Why You Shouldn’t Ignore Filter Operators In SQL Server Query Plans Part 2
AI Training for Database Teams and SQL Server Performance Tuning
We looked at a couple examples of when SQL Server might need to filter out rows later in the plan than we’d like, and why that can cause performance…
Read the post: Why You Shouldn’t Ignore Filter Operators In SQL Server Query Plans Part 2
When we write queries that need to filter data, we tend to want to have that filtering happen as far over to the right in a query plan as possible.
Read the post: Why You Shouldn’t Ignore Filter Operators In SQL Server Query Plans Part 1
This year, I’m teaching an 8 hour online workshop at Data Platform Summit, and I’d love it if you joined me.
Let’s say at some point, you just didn’t know any better, and you wrote a scalar function to make some common thing you needed to do all “modular” and…
Read the post: Not All SQL Server Function Rewrites Are Straightforward
Dynamic SQL is always a hot topic. I love using it. Got a lot of posts about it.
Read the post: How To Avoid SQL Injection In Dynamic SQL Queries In SQL Server
I have to do this a fair amount, and I always go look at this little cheat sheet that I have.
Read the post: A T-SQL Query To Get The Text Between Two Delimiters In SQL Server (2020)
When you’re writing code, you have some options when it comes to leaving comments:
Read the post: Please Use Block Quotes For Code Comments In Your T-SQL
The first query returns what appears to be rather odd results.
Read the post: How SQL Server Treats NULLs In Case Expressions
Or even application code that builds unparameterized strings, you’ve probably already had someone steal all your company data.
Read the post: Forced Parameterization Doesn’t Fix SQL Injection Problems In SQL Server
A cursor with TRY…CATCH loops forever on an error unless the FETCH NEXT also appears inside the CATCH block.
A Funny Thing Happened With Create Or Alter In SQL Server: a SQL Server video lesson from Erik Darling of Darling Data.
Read the post: A Funny Thing Happened With Create Or Alter In SQL Server
I see people using OUTPUT to audit modifications from time to time, often because “triggers are bad” or “triggers are slow”.
Read the post: An Unfortunate Performance Side Effect Of The OUTPUT Clause In SQL Server
It’s sorta kinda pretty crazy when every major database platform has something implemented, and SQL Server doesn’t.
Read the post: How To Get Greatest And Least Values In A SQL Server Query
It seems like every time I check out a server, the query plans are a nightmare. Users are freaking out, and management’s coffee is more Irish than…
Read the post: Why Functions Are Bad in SQL Server Where Clauses
There’s a strange response to some things in the SQL Server community that borders on religious fervor.
Read the post: When SELECT * Doesn’t Matter In SQL Server Queries
Running ALTER VIEW on an indexed view drops every index on it, the clustered index and any nonclustered indexes alike.
Read the post: Be Careful When You Alter SQL Server Indexed Views
Let’s say you wanna get the highest thing. That’s easy enough as a concept.
Read the post: The Fastest Way To Get The Highest Value In SQL Server Part 1
In the documentation for TOP, the following is listed as a best practice:
Read the post: SQL Server T-SQL Protip: watch those TOPs without ORDER BY
CROSS APPLY with TOP (1) can build an eager index spool that runs single threaded, so a parallel plan behaves like a serial one.
For this post I’m using the legacy cardinality estimator on SQL Server 2016 SP1.
Read the post: Manipulating Cardinality Estimates with SQL Server T-SQL Scalar UDFs
Copyright © 2019-2026 Darling Data