Neo4j模式索引非常慢

时间:2023-01-10 18:03:58

I'm trying to implement indexes in NE4OJ in order to speed up some queries.

我正在尝试在NE4OJ中实现索引以加快一些查询。

One of the queries is to find some people based on a string using where people.key IN [<10 string values here>]. We have around 180k nodes with the label People in the database and the query takes 41s to return the result.

其中一个查询是使用where.key IN [<10 string values here>]中的字符串查找某些人。我们有大约180k个节点,数据库中有People标签,查询需要41秒才能返回结果。

So I created a schema Index on this property, run again the query and nothing changed. By curiosity, I decided to select by ID:

所以我在这个属性上创建了一个模式索引,再次运行查询并且没有任何改变。由于好奇,我决定按ID选择:

match (people:People)
where ID(people) IN [789806,908117,934851,934857,935125,935174,935177,935183,935581,935586,935587,935588,935634,935636,935637,935638,935639]
return ID(people)

It took 92ms. Perfect! So I tried to create a new property called test, index it and set the same value as the node id. Then I run the following query:

花了92毫秒。完善!所以我尝试创建一个名为test的新属性,对其进行索引并设置与节点id相同的值。然后我运行以下查询:

match (people:People)
where people.test IN [789806,908117,934851,934857,935125,935174,935177,935183,935581,935586,935587,935588,935634,935636,935637,935638,935639]
return ID(people)

It took again 41s (41000ms). Am I missing something? I really don't understand... Is it some performance conf?

又花了41s(41000ms)。我错过了什么吗?我真的不明白......这是一些表现吗?

FYI, we use NEO4J 2.0.0 on Debian.

仅供参考,我们在Debian上使用NEO4J 2.0.0。

Thanks guys !

多谢你们 !

1 个解决方案

#1


1  

As far as I remember the IN operation was not using an existing index in 2.0.x. So try to upgrade to 2.1.3 and retry.

据我所知,IN操作没有使用2.0.x中的现有索引。所以尝试升级到2.1.3并重试。

#1


1  

As far as I remember the IN operation was not using an existing index in 2.0.x. So try to upgrade to 2.1.3 and retry.

据我所知,IN操作没有使用2.0.x中的现有索引。所以尝试升级到2.1.3并重试。