为什么在neo4j中返回节点比返回节点属性更快?
我运行类似的查询,首先返回节点为什么在neo4j中返回节点比返回节点属性更快?,neo4j,profiling,cypher,Neo4j,Profiling,Cypher,我运行类似的查询,首先返回节点 PROFILE MATCH (me:USER{userId:"1"})-[:in_group]->(group), (group)<-[:in_group]-(other) return group, collect(other) as participants 因为在第二个查询中,属性有一个聚合,它可能不是唯一的,并且没有索引。尝试使group.groupId成为唯一的索引。@stdob--看起来不是这样。我有索引,更新了问题。 PROFILE
PROFILE
MATCH (me:USER{userId:"1"})-[:in_group]->(group), (group)<-[:in_group]-(other)
return group, collect(other) as participants
因为在第二个查询中,属性有一个聚合,它可能不是唯一的,并且没有索引。尝试使
group.groupId
成为唯一的索引。@stdob--看起来不是这样。我有索引,更新了问题。
PROFILE
MATCH (me:USER{userId:"1"})-[:in_group]->(group), (group)<-[:in_group]-(other)
return group.groupId, collect(other.userId) as participants
Indexes
ON :USER(userId) ONLINE (for uniqueness constraint)
ON :GROUP(groupId) ONLINE (for uniqueness constraint)
Constraints
ON (user:USER) ASSERT user.userId IS UNIQUE
ON (group:GROUP) ASSERT group.groupId IS UNIQUE