rdf4j icon indicating copy to clipboard operation
rdf4j copied to clipboard

Sail level query optimisers

Open hmottestad opened this issue 4 years ago • 0 comments

Problem description

At the moment it is hard to create query optimisers that are specific to a sail. Our two main sails have widely different performance characteristics and it would be useful to create optimisers that can leverage knowledge about these specifics.

The current option is to call setOptimizerPipeline(...) in the EvaluationStrategyFactory. The main issue with this approach is that the StrictEvaluationStrategyFactory uses this pipeline to override the default pipeline of the StrictEvaluationStrategy. You could of course instantiate a StandardQueryOptimizerPipeline and get the default optimisers from there. This brings us to the second big issue which is that the StandardQueryOptimizerPipeline needs a number of arguments, namely the current EvaluationStrategy the transactions TripleSource and the EvaluationStatistics. These are all pretty hard to get a hold of at the sail level.

Preferred solution

Add functionality to the EvaluationStrategyFactory in order to inject new optimisers at runtime.

This functionality should consist of:

  • a functional interface (supplier) that is provided with EvaluationStrategy strategy, TripleSource tripleSource, EvaluationStatistics evaluationStatistics in order to instantiate a QueryOptimizer
  • methods on the EvaluationStrategyFactory to add instances of the above mentioned interface (with the ability to specify if the new QueryOptimizer should be inserted at the beginning or end of the current pipeline)
  • getters for the above
  • getter for the pipeline in EvaluationStrategy

Are you interested in contributing a solution yourself?

Yes

Alternatives you've considered

No response

Anything else?

Create a Value optimiser for the MemoryStore to swap out values in the query with the "interned" value from the MemValueFactory.

hmottestad avatar Nov 09 '21 09:11 hmottestad