Is the titanium index key search incredibly slow?

Using Titan w / Cassandra v 0.3.1, I created the vertex key index through createKeyIndex , as described in the Titan docs .

 gremlin> g.createKeyIndex("my_key", Vertex.class) ==>null 

Now I have appx 50k nodes and 186k ​​edges in the graph, and I find a significant performance difference between search queries with my_key . This request takes about 5 seconds:

 gremlin> gVhas("my_key", "abc") ==>v[12345] 

whereas the index identifier takes less than 1 second:

 gremlin> gv(12345) ==>v[12345] 

my_key does not have a single limitation (I do not want to), but I wonder what causes this performance mismatch. How to improve search performance for a non-ideal, indexed vertex key?

+6
source share
1 answer

The problem here is using .has , which is a filter function and will not use any indexes. From GremlinDocs :

It is worth noting that the has syntax is similar to gV("name", "marko") , which differs in that it is a key index search and how these will work faster. On the contrary, this line gVhas("name", "marko") will gVhas("name", "marko") over all the vertices, checking the name property of each vertex for compliance and will be much slower than the key index approach.

In the above example, this will use the index and search very quickly (<1 second):

 gremlin> gV("my_key", "abc") ==>v[12345] 
+5
source

Source: https://habr.com/ru/post/947470/


All Articles