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

Various efficiency improvements for the query planner #1724

Merged

Conversation

joka921
Copy link
Member

@joka921 joka921 commented Jan 21, 2025

These are rather minor changes in the code, but with a very significant effect for "large" queries (that is, queries with many operations):

  1. Replace std::optional<const TripleGraph> by boost::optional<const TripleGraph&>; before this change, many copies of TripleGraphs were made for large queries; note that std::optional does not work for const &
  2. Avoid re-building the cache key from scratch for each call to Operation::getCacheKey
  3. Avoid re-computing the result width from scratch for each call to Operation::getResultWidth
  4. We can now call setLimit for a whole QueryExecutionTree (before: only for an individual Operation); this invalidates the cache key and the result width
  5. Make the variable name check (which calls the ANTLR parser) an expensive check, so that these are only executed in test and in debug mode

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.91%. Comparing base (acb6633) to head (4a91c4a).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1724      +/-   ##
==========================================
+ Coverage   89.86%   89.91%   +0.04%     
==========================================
  Files         389      393       +4     
  Lines       37308    37574     +266     
  Branches     4204     4224      +20     
==========================================
+ Hits        33527    33783     +256     
- Misses       2485     2495      +10     
  Partials     1296     1296              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Johannes Kalmbach <[email protected]>
@sparql-conformance
Copy link

@hannahbast hannahbast changed the title Small improvements for the query planner. Small improvements for the query planner Jan 23, 2025
Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Awesome, thanks a lot. Two minor changes (one is a suggestion)

test/SparqlDataTypesTest.cpp Outdated Show resolved Hide resolved
@hannahbast hannahbast changed the title Small improvements for the query planner Various efficiency improvements for the query planner Jan 23, 2025
Signed-off-by: Johannes Kalmbach <[email protected]>
Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Great!

Copy link

@hannahbast hannahbast merged commit ff47922 into ad-freiburg:master Jan 23, 2025
22 of 23 checks passed
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