Skip to content

Index Join - #1008

Merged
Mytherin merged 32 commits into
masterfrom
artjoin
Oct 19, 2020
Merged

Mytherin merged 32 commits into
masterfrom
artjoin

Conversation

@pdet

@pdet pdet commented Oct 14, 2020

Copy link
Copy Markdown
Member

Using pre-existing indexes for equality joins with one comparison.

@Mytherin Mytherin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR! Looks great. Just some minor nitpicks:

Comment thread benchmark/micro/index_join.cpp Resolved
Comment thread benchmark/micro/index_join.cpp Resolved
Comment thread benchmark/micro/indexcreation.cpp Resolved
Comment thread src/execution/index/art/art.cpp Resolved
@Mytherin
Mytherin merged commit 479fd00 into master Oct 19, 2020
@pdet pdet linked an issue Oct 19, 2020 that may be closed by this pull request
@pdet
pdet deleted the artjoin branch October 20, 2020 11:38
@Alex-Monahan

Copy link
Copy Markdown
Contributor

Hi Folks!

I have a few quick questions on this one. What types of joins will this work for (inner, left)? Does it need to be a single equality operator? What if I have multiple columns in the join each with an equality comparison? Are there any data types restrictions or any other situations where this won't come into play?

My dataset is pretty big so indexing is expensive... I just want to make sure that my queries can utilize them!

Thanks!
-Alex

@pdet

pdet commented Feb 16, 2021 •

Copy link
Copy Markdown
Member Author

Hey Alex, this is only used for highly selective (If I remember correctly, up to a vector size) inner joins, so the real goal was point queries on equality joins.
The reason we decided to limit its usability is due to the tuple reconstruction costs, which quickly overcome the benefits of skipping data.
It also only works for one column, although I don't think extending it to work on a join with multiple would be such a difficult task ( I guess you're talking about having a compound index on multiple columns, or is it multiple single-dimensional indexes?)
Are you also thinking about using clustered indexes? I don't think those are supported yet, but they would solve the tuple reconstruction problem (With a penalty on storage and maintenance, ofc).

Anyway, let me know your schema and queries, and I'll be happy to take a look :-)

Btw, you can force the index joins with the following pragma, so they will be used regardless of selectivity.
PRAGMA force_index_join;

@jonathanc-n

Copy link
Copy Markdown

@pdet Hello another inquiry, is there a reason index_join got removed? Thanks in advance!

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.

Index Nested Loop Join

4 participants