gpt4 book ai didi

neo4j - 为什么配置文件查询向我显示 NodeByLabelScan 以获得在 neo4j 中具有唯一约束的属性?

转载 作者:行者123 更新时间:2023-12-02 01:33:29 25 4
gpt4 key购买 nike

在我的 neo4j 数据中,我有唯一的约束集。

neo4j-sh (?)$ schema
Indexes
ON :Post(uuid) ONLINE (for uniqueness constraint)
Constraints
ON (post:Post) ASSERT post.uuid IS UNIQUE

但是,当我对查询进行配置时,搜索似乎是由 NodeByLabelScan 完成的

    neo4j-sh (?)$ profile match (p:Post {uuid:"503cb957-9da0-490c-808d-48b64a1b1f64"}) return p;
+---+
| p |
+---+
+---+
0 row
12 ms

Compiler CYPHER 2.2

Planner COST

Filter
|
+NodeByLabelScan

+-----------------+---------------+------+--------+-------------+---------------------------+
| Operator | EstimatedRows | Rows | DbHits | Identifiers | Other |
+-----------------+---------------+------+--------+-------------+---------------------------+
| Filter | 1 | 0 | 2 | p | p.uuid == { AUTOSTRING0} |
| NodeByLabelScan | 1 | 1 | 2 | p | :Post |
+-----------------+---------------+------+--------+-------------+---------------------------+

Total database accesses: 4

我在这里遗漏了什么吗?

我的 neo4j 版本是 2.2.3。

最佳答案

Neo4j 2.2 引入了基于成本的分析器。我猜这里 Cypher 认为带过滤的 NodeByLabelScan 比索引查询更快,因为节点数量少。

关于neo4j - 为什么配置文件查询向我显示 NodeByLabelScan 以获得在 neo4j 中具有唯一约束的属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32698793/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com