SPARQL-star queries perform poorly
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 712
- Avg merge
- 15h 41m
- Merged PRs (30d)
- 53
Description
### Version
4.3.2
### What happened?
I evaluated JenaTDB2 4.3.2 with a SPARQL-star [dataset](https://zenodo.org/record/7603263/files/bearc_alldata.TB_star_hierarchical.ttl?download=1) with 9.411.041 triples (4.9 GB). I loaded the dataset with the tdb2 loader as on-disk storage. Then I tried a set of rather complex rdf-star queries only to find that none of them was able to finish. I went on to pin down the issue and tried a very simple SPARQL-star query that contains only one nested quoted triple statement:
```
select * { <<<> ?a ?b >> ?x ?y. }
```
However, even this query took about 10min (639 sec)
```
15:47:30 INFO Server :: Apache Jena Fuseki 4.3.2
15:47:30 INFO Config :: FUSEKI_HOME=/opt/apache_jena_fuseki/apache-jena-fuseki-4.3.2
15:47:30 INFO Config :: FUSEKI_BASE=/home/fkovacev/.jena/fuseki-4.3.2
15:47:30 INFO Config :: Shiro file: file:///home/fkovacev/.jena/fuseki-4.3.2/shiro.ini
15:47:31 INFO Config :: Load configuration: file:///home/fkovacev/.jena/fuseki-4.3.2/configuration/bearc_tb_sr_rs.ttl
15:47:31 INFO Server :: Configuration file: /home/fkovacev/.jena/fuseki-4.3.2/config.ttl
15:47:31 INFO Server :: Path = /bearc_tb_sr_rs
15:47:31 INFO Server :: System
15:47:31 INFO Server :: Memory: 4.0 GiB
15:47:31 INFO Server :: Java: 17.0.5
15:47:31 INFO Server :: OS: Linux 5.15.0-58-generic amd64
15:47:31 INFO Server :: PID: 106127
15:47:31 INFO Server :: Started 2023/02/03 15:47:31 CET on port 3030
15:47:52 INFO Fuseki :: [5] POST http://localhost:3030/bearc_tb_sr_rs/sparql
15:47:52 INFO Fuseki :: [5] Query = select * { <<<> ?a ?b >> ?x ?y. }
15:58:31 INFO Fuseki :: [5] 200 OK (638.810 s)
```
The memory didn't seem to be the problem.
I tried the same set of queries on GraphDB and they all needed only a few seconds.
Is it possible that Jena generally performs poorly with SPARQL-star and even worse if there are multiple nesting levels?
### Relevant output and stacktrace
_No response_
### Are you interested in making a pull request?
None
Contributor guide
Research direction
Start by reproducing the nested SPARQL-star query against the 9.4-million-triple dataset using JenaTDB2 4.3.2, then inspect the query execution path and timing. Compare the result with the reported 639-second run; done means the performance cause is identified and the query completes substantially faster without changing its results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100