7

I'm looking for a high-level, algorithmic understanding so that I can get a Big-O sense of what SQL-Server is doing to perform joins. Feel free to be concise, I'm not looking for the extremely nitty gritty. The thing that prompted me to understand how joins are implemented better is the scenario behind this question that I also just posted. I felt like they were ultimately two separate questions though, which is why I didn't combine them.

Thanks!

3 Answers 3

10

EDIT (2020-03-11): The links in this 9+ year old answer are all invalid today. I would delete the answer, but SO won't let me since it was accepted back when it was actually useful.

Original Answer:

Here's some reading to get you started.

Sign up to request clarification or add additional context in comments.

Comments

1

Honestly if you are interested at that level of detail I would suggest you read Microsoft SQL Server 2008 Internals.

And learn to read execution plans. SQL Server has a pretty good optimization engine. It doesn't always do things the way we humans would expect though or even the same way for two queries that appear to us be similar.

2 Comments

I thought the SQL Internals book kinda sucked, here's some better and free ones: red-gate.com/our-company/about/book-store
@Andomar, I hadn't seen that list but Red-Gate is a company whose products I have used and loved and I certainly wil be downloading some of these! Thanks for the link.
-1

SQL Server can choose from a variety of different joins: the most common ones are merge, loop and hash. See this KB article.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.