Date
1 - 4 of 4
Index on subquery not working
Veerle <vvanbe...@...>
Hi, I do have a graph with about 1 million vertexes and a many to many relation between those vertexes. The vertexes are I created a mixed index management.buildIndex(indexName, Vertex.class) .addKey(management.getPropertyKey("property")) .indexOnly(road) .buildMixedIndex("search"); The index is working correctly, I can see it popping up in the profile output: graph But when I want to have the same on the other side of the "connected" relation, the index is not used anymore. graph .profile().next() Does someone know how I get the subquery to use the index? Thanks a lot, Veerle |
|
BO XUAN LI <libo...@...>
Hi Veerle,
toggle quoted message
Show quoted text
Try putting both(“connected”) after has(“property”, true). Regards, Boxuan
|
|
Veerle <vvanbe...@...>
Thanks for the answer but putting has(“property”, true) before both(“connected”) changes the results of the query. I actually simplefied my query a bit for my question here but what I want is a query that selects all relations where on one side the property is true and on the other side the property is false. Something like this: V() .hasLabel("road") .has("property", true) .both("connected") .hasLabel("road") .has("property", false) .next() The first part of the query uses the index, but the second part isn't. Thanks, Veerle |
|
BO XUAN LI <libo...@...>
That’s pretty much expected. Index is used when you have a global lookup. In your case, the first has("property", true) is a global lookup, so it leverages index. The second has("property", true) is to check neighbors, or in other words, a local lookup, so it does not use index.
toggle quoted message
Show quoted text
Depending on your data, there are a couple of things you can try: 1) You can build an index for edges, which indicates whether two endpoints have opposite properties. 2) You can use different edge labels to indicate different cases. Try with and without vertex-centric indexes. 3) Retrieve all vertices with property=true and all with property=false, do in-memory filtering in your application. Hope this helps.
|
|