Cypher的ORDER BY是否使用索引? [英] Does Cypher's ORDER BY uses the index?

查看:57
本文介绍了Cypher的ORDER BY是否使用索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在:Label(Uid)和:Label(Name)上有一个索引

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

但是,当我分析(在外壳中)以下两个查询时,两个查询都得到相同的代码路径.问题是我有700,000件:Label物品,订购这些物品的速度开始非常缓慢.

However, when I profile (in the shell) the following two queries I get the same codepath for both. The issue is that I have 700,000 items of :Label, and it's starting to be painfully slow to order the items.

通过具有索引的属性进行查询排序:

Query ordering by a property with index:

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

按没有索引的属性查询顺序:

Query ordering by a property without 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 are changed:

==> 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")

推荐答案

到目前为止,neo4j尚未利用现有索引来加速ORDER BY子句.

As of now, neo4j does not take advantage of an existing index to speed up the ORDER BY clause.

您可能应该让neo4j的人们知道您希望此功能得到支持:-).

You should probably let the neo4j folks know you would like this to be supported :-).

[更新]

截至此更新(2018年1月10日),有一个打开功能请求.根据最近的评论,它应该是高度优先的功能".

There is, as of this update (Jan. 10, 2018), an open feature request for this capability. According to a recent comment, it is supposed to be a "high prioritized feature".

这篇关于Cypher的ORDER BY是否使用索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆