It takes a lot of work on your part to cache multiple plans for the same query. SQL Server 2017 adds a feature to make it easier, automatically, by watching out for situations where the amount of data coming out of one table might influence whether it should do an index seek or a scan…
Search Results for “adaptive joins”
- Home
- Search Results
Parameter Sniffing in SQL Server 2019: Adaptive Joins
So far, I’ve talked about how adaptive memory grants both help and worsen parameter sniffing, and how the new air_quote_actual plans don’t accurately show what happened. But so far, I’ve been using a simple one-table query – let’s see what happens when I add a join and a supporting index: Transact-SQL CREATE INDEX IX_OwnerUserId_Includes ON…
Read MoreAdaptive Joins, Memory Grant Feedback, and Stored Procedures
Not Exactly The Catchiest Name There’s a TL;DR here, in case you don’t feel like reading the whole darn thing. Batch mode memory grant feedback works with stored procedures It takes several runs to adjust upwards to a final number It seems to only adjust downwards once (in this case by about 40%) This isn’t…
Read MoreAdaptive Joins
NEW NEW NEW This is an informational message. These types of joins are new in SQL Server 2017, and we don’t have enough experience with them to do any analysis. Right now we’re only flagging them, but in the future we’ll add some detail around the estimated join choice and average rows, most likely, unless…
Read MoreDo SQL Server 2017’s Adaptive Joins Work with Cross Apply or Exists?
I think I’ve mentioned that the most fun part of new features is testing them with old ideas to see how they react. It occurred to me that if Adaptive Joins didn’t work with APPLY, I might cry. So, here goes nothin’! Cross Simple Cross Apply…ies can use Adaptive Joins, though at first glance there’s…
Read MoreHow Scalar Functions Can Stop You From Getting Adaptive Joins
If you’re not aware of the performance problems scalar valued functions can (and often do) cause, well, uh… click here. We’ll talk in a few days. If you are, and you’re worried about them crapping on Adaptive Joins, follow along. The big question I had is if various uses of scalar valued functions would inhibit…
Read MoreAdaptive Joins And SARGability
There’s a famous saying Non-SARGable predicates don’t get missing index requests. And that’s true! But can they also stifle my favorite thing to happen to SQL Server since, well, last week? You betcha!© One Sided I’m going to paste in some queries, each with something non-SARGable. There are two tables involved: Users and Posts. Only…
Read MoreAdaptive Joins And Local Variables
With new features I really love kicking the tires to see how they work with existing features, and if they fix existing performance troubleshooting scenarios. One issue that I see frequently is with local variables. I’m not going to get into Cardinality Estimator math here, we’re just going to look at Adaptive Join plan choice…
Read MoreLook Ma, Adaptive Joins
This probably won’t seem like a big deal soon But I just got the optimizer to pick an Adaptive Join! It took a few tries to figure out what would cause some guesswork to happen, but here it is. I hope Joe Sack has strong ribs. And here’s the tool tip info! Dynamic Duo This…
Read MoreWhat’s New in SQL Server 2019: Adaptive Memory Grants
When you run a query, SQL Server guesses how much memory you’re going to need for things like sorts and joins. As your query starts, it gets an allocation of workspace memory, then starts work. Sometimes SQL Server underestimates the work you’re about to do, and doesn’t grant you enough memory. Say you’re working with…
Read MoreHow Many Kinds Of Joins Are There?
Quite So There are three in SQL Server, not counting the Adaptive Join which is just a placeholder for either Nested Loops or Hash Joins. If you look closely at each of those joins, you’ll see all sorts of interesting things pop up. Hopefully none of them will be Sorts. NOT EXISTS Nested Loops has:…
Read MoreAdaptive Blog Posts
It turns out I can be dumb In a previous blog post about Adaptive Joins, I thought that EXISTS wasn’t supported by the new feature. It turns out that EXISTS is totally 100% supported, as long as your indexes support EXISTS. To show this, I need to show you a query that gets an Adaptive…
Read MoreAnatomy Of An Adaptive Join
I don’t like it unless it’s brand new When new features drop, not everyone has time to jump on top of them and start looking at stuff. That’s what consultants with nothing better to do are for. I’ve been excited about this feature since talking to The Honorable Joseph Q. Sack, Esq. about it at…
Read MoreThe 2017 Adaptive Join Optimization Eats Bad TSQL For Breakfast
Cheeky If you thought that title sounded familiar, you sure were right. That’s called a classical reference. So here we are, three whole years later, and yet another improvement to the engine promises to fix performance issues forever and ever. While this isn’t exactly an entirely new cardinality estimator, it’s an entirely new branch in…
Read MoreRegistration is Open Now for My SQLBits Workshop!
Registration just opened up for my SQLBits workshop on Mastering Parameter Sniffing! Move fast – due to COVID, they’re spacing out the attendees, so there are even less seats available than usual. My workshops usually sell out quickly, so if you want a seat, you’ll need to hustle in. Here’s the session abstract: You’re a…
Read MoreGoing to SQLBits? Join me for my Mastering Parameter Sniffing workshop.
You’re a database developer or DBA with at least 3 years experience performance tuning queries and indexes. You already know you have parameter sniffing issues, and now you need to figure out how to fix it. In this one-day class, you’ll learn how to reduce the blast radius with index changes, query tuning, and database-level…
Read More[Video] Office Hours: Ask Me Anything at the Old Harbor in Reykjavik
On a very chilly morning, I went through your highly-upvoted questions from here and talked through ’em: Here’s what we covered: 00:00 Introductions 01:02 Johnny: Good morning, Brent! VARCHAR or NVARCHAR; which one to use in our Western world? One could say that disk space is cheap so it doesn’t matter. But with SQL Server’s…
Read More6 – How Execution Plans Use TempDB
When you see a yellow bang warnings on sort, hash match, or adaptive join operators in an execution plan, that’s a sign that TempDB was invited to the party. When SQL Server runs out of memory, the data spills over into TempDB. Let’s see how it happens, and what we can do about it. Demo…
To access this incredible, amazing content, you gotta get Recorded Class Season Pass or Fundamentals of TempDB, or log in if you already shelled out the cash.
Statistics Aren’t Guarantees: SQL Server Still Checks.
When I’m reviewing plans with folks, I get this response a lot: But SQL Server should know there’s no data that matches! It has statistics! Statistics are guideposts, not guarantees. We’ll start with the Stack Overflow database and put an index on LastAccessDate, which also creates a statistic on that column. We’ll check the min…
Read MoreThe 201 Buckets Problem, Part 2: How Bad Estimates Backfire As Your Data Grows
In the last post, I talked about how we don’t get accurate estimates because SQL Server’s statistics only have up to 201 buckets in the histogram. It didn’t matter much in that post, though, because we were using the small StackOverflow2010 database. But what happens as our data grows? Let’s move to a newer Stack…
Read More
Hi! I’m Brent Ozar.
I make Microsoft SQL Server go faster. I love teaching, travel, cars, and laughing. I’m based out of Las Vegas. He/him. I teach SQL Server training classes, or if you haven’t got time for the pain, I’m available for consulting too.
Want to advertise here and reach my savvy readers?