From the course: SQL Server Performance for Developers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Nested loop vs. hash join - SQL Server Tutorial
From the course: SQL Server Performance for Developers
Nested loop vs. hash join
- [Instructor] Next we're going to talk about nested loop versus hash joins. These are two different types of joins that are options in SQL Server. And when we say they're options, they're options to the query optimizer. You can influence the behavior which you'll see in the demo. However, typically this isn't something you're going to do and you're going to let the optimizer make the decision for you and the optimizer is going to make that decision based on the number of rows and number of columns and a number of other factors that it's estimated into its costing model to join that data together. In particular, we're going to talk about hash joins and nested loops, but SQL Server also uses merge joins in addition to hash and nested loop joins. What hash joins are is a table that gets created in memory to match values together and bring them together for your join operation. Hash joins are very efficient on a large set of data. They're less efficient on a very small set of data…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Execution plans introduction4m 55s
-
(Locked)
How to read an execution plan6m 14s
-
(Locked)
Execution plan XMLs2m 38s
-
(Locked)
Key lookup: When it's good and when it's bad4m 22s
-
(Locked)
Nested loop vs. hash join4m 56s
-
(Locked)
Query Store7m 54s
-
(Locked)
Stored procedures vs. dynamic SQL5m 26s
-
(Locked)
Missing index warnings6m 6s
-
-
-
-
-
-
-
-