Neo4j 2.0 Merge with unique constraints performance bug?

前端 未结 1 749
忘掉有多难
忘掉有多难 2021-01-24 13:33

Here\'s the situation: I have a node that has a property ContactId which is set as unique and indexed. The node label is :Contact (node:Contact {ContactId:1})

I have an

相关标签:
1条回答
  • 2021-01-24 13:51

    Constraint checks are more expensive than just inserts. They also take a global lock on the constraint to prevent multiple insertion.

    I saw you don't use parameters, but string substitiution, I really recommend to change that and go with parameters.

    Also setting the whole node c to n triggers constraint check again.

    Your probably want to use the ON CREATE SET clause of MERGE

    (n in {nodes} |  
    MERGE (c:Label {key : n.key}}) ON CREATE SET c.foo = n.foo, c.bar = n.bar )
    
    0 讨论(0)
提交回复
热议问题