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
It’s a question which has come up a couple of times. If a subscriber of a transactional replication publication becomes corrupt, is running CheckDB with repair allow data loss safe?
The theory is, since the subscriber is a copy of another database, allowing CheckDB to discard data in the process… Read more
I’ve come to really like Distributed Replay in the last couple of years. I’ve used it to do a scale test, I’ve used it to test a workload for performance regressions before upgrading. It has a lot of possibilities.
One problem with it is there’s no GUI, so configuring it… Read more
There are many, many guides to successfully completing a post grad degree, so I am not going to add to them. Instead, this is a list of things, based on personal experience, that you can do to make it somewhere between very difficult and impossible to complete that Masters or… Read more
By now I expect this news is no longer new: the MCM, MSA, and renamed versions of those certifications are no longer being offered after Oct 1, 2013. The announcement was made in email, late on Friday night is the US, which was Saturday morning for those… Read more
Right, I know it’s Friday and everyone’s tired and looking forward to the weekend, but I do need to finish off this indexing section and I’ll try to keep this short and interesting and hopefully keep everyone awake.
There’s no shortage of information available on how to create indexes. Hell,… Read more
Welcome back to day 2 of Advanced Indexing. Today we’re going to look at a feature that was added in SQL Server 2008 – filtered indexes.
In versions previous, indexes were always on the entire table. An index would always have the same numb of rows as the table it… Read more
Good day everyone and welcome to another week of SQL University. I know we’re getting close to the end of the year and everyone’s looking forward to a nice long vacation soaking up the sun at the beach, but a little bit of attention would be nice. Thank you.
This… Read more
I finally found the time to work through the questions from the 24 Hours of PASS session that I did. Thanks to everyone that attended the event
Q1: Can you filter execution plans for sort warnings?
No. The sort and hash warnings don’t appear in the execution plan. You’d have… Read more