Quantcast
Channel: T-SQL – SQL in the Wild
Browsing latest articles
Browse All 43 View Live

Image may be NSFW.
Clik here to view.

When naming transactions causes an error

For the last part of the series on transactions, I’m going to look at a problem that I ran across entirely by chance while doing some performance tuning. A procedure had a transaction in it, and it was...

View Article


Image may be NSFW.
Clik here to view.

Does an index scan always read the entire index?

No. That’s a bit short for a blog post, so let me explain. First, the difference between a seek and a scan. A seek is an operation which navigates down the index’s b-tree looking for a row or for the...

View Article


Image may be NSFW.
Clik here to view.

On the addition of useless where clauses

I remember a forum thread from a while back. The question was on how to get rid of the index scan that was in the query plan. Now that’s a poor question in the first place, as the scan might not be a...

View Article

Image may be NSFW.
Clik here to view.

and other pointless query rewrites

In a similar vein to last week’s blog post… I heard an interesting comment recently. “Change that Column != 2 to a Column > 2 or Column < 2 combination, it can use indexes better.” Sounds like...

View Article

Image may be NSFW.
Clik here to view.

SQL Server 2016 features: Temporal Tables

Another new feature in SQL 2016 is the Temporal Table (or System Versioning, as its referred to in the documentation). It allows a table to be versioned, in terms of data, and for queries to access...

View Article


Image may be NSFW.
Clik here to view.

What is a SARGable predicate?

‘SARGable’ is a weird term. It gets bandied around a lot when talking about indexes and whether queries can seek on indexes. The term’s an abbreviation, ‘SARG’ stands for Search ARGument, and it means...

View Article

Image may be NSFW.
Clik here to view.

Homebuilt sequential columns

I gave my introductory session on transactions at all three of the South African SQL Saturdays in 2016, as well as at SQL Saturday Oregon in October 2017, and something that came up in most of them was...

View Article

Image may be NSFW.
Clik here to view.

Revisiting catch-all queries

I originally wrote about catch-all queries early in 2009, just as something that I’d seen several times in client code. It turned into the 3rd most popular post ever on my blog. A lot’s changed since...

View Article


Image may be NSFW.
Clik here to view.

No, this is not a bug in T-SQL

(or, Column scope and binding order in subqueries) I keep seeing this in all sorts of places. People getting an unexpected result when working with a subquery, typically an IN subquery, and assuming...

View Article


In-line scalar functions in SQL Server 2019

Yes, yes, yes, finally! It’s hardly a secret that I’m not a fan of scalar user-defined functions. I refer to them as ‘developer pit-traps’ due to the amount of times I’ve seen developers absolutely...

View Article
Browsing latest articles
Browse All 43 View Live