From what I've read, ORDER BY should use an existing index. This seems not to be the case, at least with Neo4j Community Edition 5.8.0 which I'm currently evaluating.
I have a very simple model with about ~1 million Item nodes that have a name property.
I've created an index using the following command: CREATE INDEX item_name FOR (i:Item) ON (i.name)
The following query returns the first 100 name properties in ascending order: MATCH (n:Item) RETURN n.name ORDER BY n.name LIMIT 100
But the query takes ~300 ms. This feels slow. I expected it to use the item_name index and run much faster.
See attachment for the query plan generated via: PROFILE MATCH (n:Item) RETURN n.name ORDER BY n.name LIMIT 100
indeed, it works with a WHERE clause on n.name. Can be n.name IS NOT NULL as you suggested, or n.name<>'foobar' or whatever. Query performance is now down to 1 or 2 ms.
Here's the query plan (now using NodeIndexScan instead of NodeByLabelScan).