From the course: Advanced SQL for Query Tuning and Performance Optimization
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Merge join example - SQL Tutorial
From the course: Advanced SQL for Query Tuning and Performance Optimization
Merge join example
- [Instructor] We'll now see what a mergejoin looks like. We'll start with our directives, and we will disable the use of a hashjoin by setting enable_hashjoin to false, and we'll enable the mergejoin by setting the directive to true, and we'll paste in, once again, our query that we've been using, and again, we're going to look at the staff table, and from the staff table, we're going to return the id, last_name, and job_title, and from the company_regions table, we're going to return the country, so let's run this and see what a mergejoin looks like, and we'll just scroll over to the panel with our explain results, and what we'll see, starting at the top here, is, first of all, the mergejoin costs about 132 computational units, so this is definitely not the optimal plan, but that's okay. We are interested in understanding what the structure of a mergejoin looks like. Well, the first thing we'll see is that we're…
Contents
-
-
-
-
-
-
Types of joins2m 36s
-
(Locked)
Nested loops3m 19s
-
(Locked)
Nested loop example plan3m 59s
-
(Locked)
Hash joins1m 29s
-
(Locked)
Hash join example plan1m 54s
-
(Locked)
Merge joins2m 23s
-
(Locked)
Merge join example3m 2s
-
(Locked)
Subqueries vs. joins1m 13s
-
(Locked)
Challenge: Designing a join24s
-
(Locked)
Solution: Designing a join22s
-
-
-
-
-
-