Does Cypher ORDER BY use an index?

I have an index on: Label (Uid) and: Label (Name)

However, when I profile (in the shell) the following two requests, I get the same code for both. The problem is that I have 700,000 items: Shortcut, and it starts painfully slowly ordering items.

The order of queries using a property with an index:

MATCH (item:Label) RETURN item.Name ORDER BY item.Name SKIP 1000 LIMIT 50 

The order of a query using a property without an index:

 MATCH (item:Label) RETURN item.Name ORDER BY item.Created SKIP 1000 LIMIT 50 

The profiler gets me (almost) the same thing for both, only the parameters change:

 ==> ColumnFilter(symKeys=["item", "item.Name", " UNNAMEDS885193287"], returnItemNames=["item.Name"], _rows=30, _db_hits=0) ==> Slice(skip="Literal(1000)", _rows=30, _db_hits=0) ==> Top(orderBy=["SortItem(Cached( UNNAMEDS885193287 of type Any),true)"], limit="Add(Literal(1000),Literal(50))", _rows=1030, _db_hits=0) ==> Extract(symKeys=["item"], exprKeys=["item.Name", " UNNAMEDS885193287"], _rows=768596, _db_hits=1537192) ==> NodeByLabel(identifier="item", _db_hits=0, _rows=768596, label="Label", identifiers=["item"], producer="NodeByLabel") 
+6
source share
1 answer

Neo4j does not currently use the existing index to speed up the ORDER BY .

You probably should know that neo4j people know that you want this to be supported :-).

[UPDATE]

As of this update (January 10, 2018), open a feature request for this feature. According to a recent comment, it should be a "high priority feature."

+7
source

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


All Articles