Index does not work when using order().by() in Titan

前端 未结 1 1405
耶瑟儿~
耶瑟儿~ 2021-01-21 23:14

The Titan documentation says that:

Mixed indexes support ordering natively and efficiently. However, the property key used in the order().by() method must

相关标签:
1条回答
  • 2021-01-21 23:35

    You must supply a value to filter on for the indices to be used. Here:

    g.V().order().by('prop1', incr)
    

    you don't provide any filter, so Titan has to iterate all of V() and then applies the sort.

    Here:

    g.V().has('prop1').count()
    

    you supply a indexed key but don't specify a value to filter on so it's still iterating all of V(). You could do:

    g.V().has("prop1", textRegex(".*")).count()
    

    In this case, you would fake Titan out a bit, but the query still could be slow anyway if that query returns a lot of results to iterate over.

    0 讨论(0)
提交回复
热议问题