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

If the last operation is lazy, cache the result independently of lazy-result-max-cache-size #1701

Open
hannahbast opened this issue Jan 5, 2025 · 3 comments · May be fixed by #1709
Open

Comments

@hannahbast
Copy link
Member

Since #1638, QLever has the runtime parameter lazy-result-max-cache-size, with a deliberately small default value of 5 MB. However, I would argue that the final result should be cached independently of the value of lazy-result-max-cache-size but just depending on the CACHE_MAX_SIZE... settings, even if the last operation is output-lazy.

Here is an example query that is quite expensive to compute (all street intersections in the United States), but where the final result has "only" a size of 11M x 5 ~ 440 MB. So no problem for the normal cache, but too large for the lazy cache.

https://qlever.cs.uni-freiburg.de/osm-planet/1DHcyB

When repeating the query, the result before the last operation is stored in the cache, but the lazy join at the end is repeated every time. This is also a good example for a query, where the intermediate results should not be cached (but the final result should be).

@RobinTF @joka921 What do you think?

@RobinTF
Copy link
Collaborator

RobinTF commented Jan 5, 2025

@hannahbast I think this is a reasonable thing to do, especially because the final LIMIT is not applied for the last operation, so even with limit it is likely to be bigger.

@hannahbast
Copy link
Member Author

@RobinTF Thanks for the feedback + I agree. Can you pinpoint the location in the code, where this change would have to be made? It looks like a small change to me, but maybe I am overlooking something?

@RobinTF
Copy link
Collaborator

RobinTF commented Jan 5, 2025

The max size is defined here:

auto maxSize =
std::min(RuntimeParameters().get<"lazy-result-max-cache-size">(),
cache.getMaxSizeSingleEntry());

You'd have to pass the "isRoot" bool to this function though

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 a pull request may close this issue.

2 participants