Fast Range Queries and how to Code them #2142
Replies: 4 comments 1 reply
-
I have been thinking a bit on the syntax for the range queries, please share your input if this is a relevant way!
Should a separate term, where be introduced, does it make sense to use the way of expressing as() as a template form for where, or should we use the base mechanisms (perhaps better) to express this, but expect that they get bolted on to the triple to make them pass into the rust engine. There are some considerations to make for the WOQL language to continue with the correct traditions. |
Beta Was this translation helpful? Give feedback.
-
I think the current constraints are sufficient without having to add another operator. We just need to find the constraints on a given meta-variable and then send it in during the original triple query as an additional parameter to the iterator. |
Beta Was this translation helpful? Give feedback.
-
I noticed an additional possible improvement for the triple() WOQL after comparing the performance between WOQL and GraphQL. GraphQL is (as expected) significantly faster in traversing the triple store. By potentially combining the filtering available in the GraphQL interface, a significant improvement could be achieved even before the range queries are implemented. What would be needed in any case, as mentioned, is to identify the triple constraints on the variable in WOQL and feed them into rust so that rust could pre-filter the query. That would already be a significant improvement in itself, and the range queries take the next step in improvement. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The storage of all XSD data types is stored in sorted order. This means that it is possible in principle to perform fast range queries. There are however a number of technical steps that have to be undertaken for this to work.
The prolog code functions by means of iterators, writen in rust, driven by mode. Different iterators are used for different modes. In the case of a sorting order it would need to be driven by an additional low level iterator which knew which direction to sort of objects on.
In addition terminus store is composed (in the general case) of parts. You will have negative and positive layers which tell whether something has been deleted or added. A general sort requires that the iterator walk up and down layers according to the next object across every layer which is exposed, adding the next result from each layer and filtering out those that are deleted.
If this iterator is implemented then the query compiler needs to be informed that a particular ordering will improve performance. This is a symbolic sort that can be performed in pure and not so complicated prolog. However after this is done some primitive needs to be exposed for the compilation step which will utilise the rust iterator.
So it will require work in both rust and prolog. The good news is that it should be possible to get very fast range queries this way as the storage primitives support it.
Beta Was this translation helpful? Give feedback.
All reactions