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

Optimizations Database Operations: Join #83

Closed
aannleax opened this issue Jan 5, 2023 · 1 comment
Closed

Optimizations Database Operations: Join #83

aannleax opened this issue Jan 5, 2023 · 1 comment
Assignees
Labels
good first issue Good for newcomers

Comments

@aannleax
Copy link
Member

aannleax commented Jan 5, 2023

Suppose you want to evaluate the rule

   a(x, y) b(y, z) c(z) -> d(x, y)

Currently this would compute the temporary table tmp(x, y, z) and then project this down to d(x, y).

This is inefficient because the result does not care about every valid z-value. Hence it would suffice to know that one such value exists and move on to the next x, y pair.

To illustrate, consider a database with a(1, 2), b(2, 5), b(2, 6), c(5), c(6). We'd obtain tmp(1, 2, 5) and tmp(1, 2, 6), even though we only need to save d(1, 2).

@aannleax
Copy link
Member Author

Implemented in #191.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants