cayleygraph / cayley

An open-source graph database
https://cayley.io
Apache License 2.0
14.85k stars 1.25k forks source link

LinkedQL + Bolt: .out().is() is slower than .has().union(.has()) #889

Open iddan opened 4 years ago

iddan commented 4 years ago

Description When executing:

g.V().out(predicate).is(a, b)

It is signifcantly slower than

g.V().has(predicate, a).union(g.V().has(predicate, .b)

I presume it has to do with the way we use indexes for .out().is() which is not optimized like .has()

dennwc commented 4 years ago

I think I know why it behaves that way. It currently only optimizes has with a single value. It can do better by automatically adding a union on quad indexes.