I am testing some basic queries (on an instance with ~10m triples) around edge attributes and noticed a very large difference between including a wildcard ?edgeAttributeProperty or not:
Can I speed this up somehow? (I.e. shouldn't the engine somehow be able to limit the scope of search to the triple and its related edge attributes? It seems to search unnecessarily wide?)
Here's the sample data for the query:
INSERT DATA {
<< :angola :independence_year 1961 >> :source :wikipedia, :dbpedia; :relatedEvent "Angolan War of Independence"
}
Yes, PSO vs SPO plays a role but the root cause is the join algorithm (nested loops). It can be very inefficient depending on the order in which operands produce inputs. It shouldn't be used in this case but there's a known issue PLAT-2502 which creates loop joins when the join variable is assigned in certain BIND expressions (in this case, GetStatement).
For now you'd need to use a longer form for this query instead of the <<>> shortcut:
Here I'm working around the problem by using an artificial coalesce call to tell the query engine that the ?statement variable cannot have a null value so it can use faster join algorithms. This is a bit awkward and we should fix the issue soon (GetStatement shouldn't trigger errors and thus shouldn't return nulls in this case).