‘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 that the predicate can be executed using an index seek.
Lovely. So a predicate must be… Read more
One of the more interesting features in SQL 2016 is the integration of the R language.
For those who haven’t seen it before, R is a statistical and data analysis language. It’s been around for ages, and has become popular in recent years.
R looks something like this (and I… Read more
It’s shaping up to a busy year for conferences, well busy by my standards that is. While I’m unfortunately missing SQLBits, I’ll still be getting a chance to enjoy an English summer.
Stretch database allows for a table to span an ‘earthed’ SQL Server instance and an Azure SQL Database. It allows for parts (or all) of a table, presumably older, less used parts, to be stored in Azure instead of on local servers. This could be very valuable for companies that… Read more
Ever wanted to look at a query’s actual execution plan (execution plan with runtime information) without waiting for the query to finish? Now you can.
Enable that and run a query, and you get an execution plan immediately, one with a few more details in it than we’re used to. Read more
Given that SQL Server 2016 is coming ‘real soon now’, it’s probably well past time that I write up some thoughts on new features.
The first one I want to look at is a feature that I’m so looking forward to getting to use, the Query Store.
Query Store is… Read more
This post, like last week’s, is based off the presentation I did to the DBA Fundamentals virtual chapter.
The request was for more details on the method I use to capture wait and file stats on servers, The methods are pretty similar, so I’ll show waits.
This is by no… Read more
A couple weeks ago I presented to the DBA Fundamentals virtual chapter. The presentation was recorded and is available from their site.
While I answered some questions during the presentation, I couldn’t answer all of them. Hence this blog post with the rest of the questions and some answers.
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 something that clearly needs testing!
I’ll start with simple numbers table.
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 problem, but it’s the first answer that… Read more
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 start/end of a range of rows. A seek requires a… Read more
There’s two fairly common questions I see on the forums around SQL Server’s memory usage. Either the question asks why SQL’s using too much memory, or why it’s using too little.
Too much memory isn’t usually a real problem, it’s often due to max server memory being left at its… Read more
One new thing that SQL Server 2016 has added is the ability to natively compile user-defined functions. Previously, native compilation, part of the hekaton feature, was limited to stored procedures.
When I saw that, the first question that came to mind is whether natively compiling a scalar function reduces the… Read more
It’s been a few years since I wrote a review of books I’ve read, so this isn’t going to list everything I’ve read since 2012, just a few of the best books or series. For the entire list of all books, see the library page.
So, 2015. I set… Read more
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 named. Something like this:
CREATE PROCEDURE RemoveUser (@UserID INT) AS BEGIN TRY…
Something that i keep seeing in documentation, in forum code and in real systems is transactions that have names
BEGIN TRANSACTION VeryImportantProcess <do stuff> COMMIT VeryImportantProcess
Now the question came up on the forums a while back as to what the point of this is. Why would you name a… Read more
This is the second in a short series on transactions. In the previous part I discussed nested transactions and showed that they actually don’t exist. SQL has syntax which may suggest that nested transactions exist, but it’s just a syntactical lie.
One thing I suggested in that post was that… Read more
Transactions are an area that I often find are used badly, or not used at all. Transactions without any error handling, nested transactions, named transactions named for no good reason or just plain lack of transactions where they should be used.
This is going to be the first of three… Read more
There is a particularly irritating and persistent belief that indexes (usually it’s the clustered that gets picked on) are always physically ordered within the data file by the key columns. That is, that the data within the database file is always ordered by the key column.
It doesn’t help that… Read more
There was a question raised some time back ‘If an index is not selective, will the query operators that use it always be index scans’?
It’s an interesting question and requires a look at what’s going on behind the scenes in order to answer properly..
Short answer: No, not always. Read more