X Tutup
The Wayback Machine - https://web.archive.org/web/20201027230152/https://github.com/tonsky/datascript/pull/362
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

Simple hash-join optimization #362

Open
wants to merge 2 commits into
base: master
from
Open

Simple hash-join optimization #362

wants to merge 2 commits into from

Conversation

@huahaiy
Copy link

@huahaiy huahaiy commented Jul 24, 2020

In hash-join of two relations, a simple optimization is to create the hash table on the smaller side of the relations. This simple change can noticeably improve query performance in some cases.

For instance, if we change q2 of the benchmark from [:find ?e ?a :where [?e :name "Ivan"] [?e :age ?a]] to [:find ?e ?a :where [?e :sex ?a] [?e :name "Ivan"]]. On my machine, before this optimization, the query time is 9.5ms, after the optimization, it is 6.5ms.

Credit: This optimization is one of the techniques introduced in this paper:

Fan et al. 2019, Scaling-up in-memory datalog processing: observations and techniques, Proceedings of the VLDB Endowment, vol. 12. Full text: http://www.vldb.org/pvldb/vol12/p695-fan.pdf

@tonsky
Copy link
Owner

@tonsky tonsky commented Jul 24, 2020

Thanks! Strange, I was sure I am already doing this :) Seems like not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.
X Tutup