为什么配置文件查询显示我NodeByLabelScan的属性,在neo4j中有一个唯一的约束



在我的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与过滤比索引查询更快,因为节点数量少。

最新更新