Search Results for “execution plan”

6 Execution Plans are Lying Liars

So far in the class, I’ve made a lot of assumptions that what’s onscreen is the truth. However, that’s because we’ve been dealing with relatively straightforward queries. Before I let you loose in the real world, I need to point out that a lot of what you see in complex query plans is actually garbage….

To access this incredible, amazing content, you gotta get Fundamentals of Query Tuning or Recorded Class Season Pass, or log in if you already shelled out the cash.
Read More

6 – 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.
Read More

07 – Execution Plans are Lying Liars (24m)

When you look at the arrows on an actual plan, what do the arrow sizes mean? When you see the list of wait stats, they’re accurate, right? Buckle up and prepare to be disappointed – a lot of what you see in a query plan just flat out isn’t true. Here is the demo script:…

To access this incredible, amazing content, you gotta get Recorded Class Season Pass, or log in if you already shelled out the cash.
Read More

2.1 Building Execution Plans Part 2 (22m)

Now let’s step through an execution plan in minute details to see where the estimates from each operator come from, and how they can go wildly wrong. If you want to follow along in SSMS, here’s the query: Transact-SQL SELECT Location, COUNT(*) FROM dbo.Users GROUP BY Location ORDER BY COUNT(*) DESC OPTION (MAXDOP 1); 12345…

You’ll need a membership to access this course. Check out my training classes.
Read More

What’s the Difference Between Estimated and Actual Execution Plans?

I’m going to use the dbo.Users table in the StackOverflow demo database and run a pretty simple query: Transact-SQL SELECT * FROM dbo.Users WHERE DisplayName LIKE 'Brent%'; 123 SELECT *FROM dbo.UsersWHERE DisplayName LIKE 'Brent%'; First, hit Control-L in SSMS and get the estimated execution plan. Here it is: Estimated execution plan: https://www.brentozar.com/pastetheplan/?id=H1TeRlZke Click on the…
Read More

Announcing PasteThePlan.com: An Easier Way to Share Execution Plans

Since the dawn of man, people have struggled with sharing execution plans with each other for performance tuning. Now, it’s easy. First, get yourself a plan: Get the estimated execution plan by hitting control-L or clicking Query, Display Estimated Plan. Right-click on the graphical plan, and click View XML. Copy all of that. Or even…
Read More

Getting an Oracle Execution Plan

Oracle
3 Comments
Execution plans are fantastic – they make it easier to visualize how a query is running and find tuning opportunities. SQL Server DBAs starting with Oracle may be a bit frustrated by the lack of a clear way to get to execution plans. This covers three ways to get to execution plans in Oracle –…
Read More
Plan Guides are like duct tape

Stabilizing Execution Plans: Plan Guides and NORECOMPUTE

What could go wrong? Sometimes you end up in a good plan / bad plan situation: an important query runs just fine most of the time. The query is parameterized, a good execution plan gets re-used, everything is cool. But sometimes, a “bad plan” gets compiled and starts to be reused. This is “bad” parameter sniffing. “Bad plans” can…
Read More