[
https://issues.apache.org/jira/browse/TINKERPOP-1575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15708985#comment-15708985
]
Branden Moore commented on TINKERPOP-1575:
------------------------------------------
I should add that a workaround is to formulate the query as:
{noformat}
gremlin g.V(0).union(V().hasLabel("alpha").has("myProp", 10),
V().hasLabel("beta").has("myProp", 10))...
{noformat}
Indexing provides sufficient performance that running multiple indexed lookups
vastly out-performs a single non-indexed lookup. I would recommend checking
for label.within() as well as label.eq() for non-linear scans. In the case of
label.within(), perform multiple indexed lookups, and return the union.
> Neo4j indicies not used when multiple labels are searched for
> -------------------------------------------------------------
>
> Key: TINKERPOP-1575
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1575
> Project: TinkerPop
> Issue Type: Improvement
> Components: neo4j
> Affects Versions: 3.2.3
> Reporter: Branden Moore
> Priority: Minor
> Labels: performance
>
> When using a Neo4j-based graph, indicies are not used when more than one
> label is searched for.
> {noformat}
> gremlin> g.V().hasLabel("alpha").has("myProp", 10)
> Final Traversal [Neo4jGraphStep(vertex,[~label.eq(alpha),myProp.eq(10)]))]
> gremlin> g.V().hasLabel("alpha", "beta").has("myProp", 10)
> Final Traversal
> [Neo4jGraphStep(vertex,[~label.within(alpha,beta),myProp.eq(10)]))]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)