Skip to main content
InterviewHubPRO
Section Overview
Q22

Question 22 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

44%
SQL & Relational Databases (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

What are the three primary physical Join Algorithms (Nested Loop, Hash Join, Merge Join)?

senior Levelsql-databasesAdvanced Internals

In Simple Words:

  1. Nested Loop Join: Outer loop iterates through Table A, inner loop looks up Table B via index. Best for small outer table and indexed inner table.
  2. Hash Join: In-memory hash table is built from Table A on the join key. Table B is scanned, probing the hash table. Best for large unindexed equijoins.
  3. Sort-Merge Join: Both tables are sorted by join key, then merged in a single coordinated sequential scan. Ideal for large sorted tables.