Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Nested Loops Join #11

Merged
merged 19 commits into from
Mar 5, 2022
Merged

Implement Nested Loops Join #11

merged 19 commits into from
Mar 5, 2022

Conversation

xinyee20
Copy link
Collaborator

@xinyee20 xinyee20 commented Feb 19, 2022

Changes in this PR

  • Bug fix
  • New feature
  • Breaking change of an existing feature
  • Refactor/Performance enhancements

Overview

Implementation of Nested Loops Join.

Test Command:

select sid, sname, eid from student, enroll where sid = studentid

Expected Result:

 sid sname eid
--------------
  1  joe 14
  1  joe 24
  2  amy 34
  4  sue 44
  4  sue 54
  6  kim 64

Output is correct.

To test sort-merge join for sorting that requires at least 2 runs

Test command: (requires 2 runs)

select sid,sname from student, enroll, section where sid=studentid and sectionid=sectid

Expected Result:

 sid sname
----------
  1  joe
  4  sue
  1  joe
  2  amy
  4  sue
  6  kim

Output is correct.

Base automatically changed from feature/sort-merge-join to master February 20, 2022 18:31
@xinyee20 xinyee20 changed the title [WIP] Implement Nested Loops Join draft Implement Nested Loops Join Feb 21, 2022
@don-tay
Copy link
Owner

don-tay commented Feb 21, 2022

Change optimization of join method to count based on num of block accesses:
with idx on sid:

SQL> select sid, sname, eid from student, enroll where sid = studentid
p1Cost: 19 p2Cost: 3 p3Cost: 13
Running sort merge
 sid sname eid
--------------
  1  joe 14
  1  joe 24
  2  amy 34
  4  sue 44
  4  sue 54
  6  kim 64

without idx on sid:

SQL> select sid, sname, eid from student, enroll where sid = studentid
p1Cost: 2147483647 p2Cost: 3 p3Cost: 13
Running sort merge
 sid sname eid
--------------
  1  joe 14
  1  joe 24
  2  amy 34
  4  sue 44
  4  sue 54
  6  kim 64

@xinyee20
Copy link
Collaborator Author

Change optimization of join method to count based on num of block accesses: with idx on sid:

SQL> select sid, sname, eid from student, enroll where sid = studentid
p1Cost: 19 p2Cost: 3 p3Cost: 13
Running sort merge
 sid sname eid
--------------
  1  joe 14
  1  joe 24
  2  amy 34
  4  sue 44
  4  sue 54
  6  kim 64

without idx on sid:

SQL> select sid, sname, eid from student, enroll where sid = studentid
p1Cost: 2147483647 p2Cost: 3 p3Cost: 13
Running sort merge
 sid sname eid
--------------
  1  joe 14
  1  joe 24
  2  amy 34
  4  sue 44
  4  sue 54
  6  kim 64

Context: p1 - IndexJoinPlan | p2 - MergeJoinPlan | p3 - NestedLoopsJoinPlan

Copy link
Owner

@don-tay don-tay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@don-tay don-tay merged commit cc9d48b into master Mar 5, 2022
@don-tay don-tay deleted the nested-loop-join branch March 5, 2022 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants