Well, what a merge will do is check whether something exists before it
creates it, "match or create". The match step will get linearly slower as
it has to scan larger and larger lists of nodes on a label. If you add an
index (at minimum), or unique constraint/node key (preferred, especially if
you require uniqueness and will eventually have concurrent requests of this
nature), it will be able to do the match step much quicker.

On Thu, Feb 7, 2019 at 12:50 PM Andrea Balzoni <andrea.balz...@keypartner.it>
wrote:

> Honestly i heard of those, but i'm not using any. I'm quite new to it, so
> i wasnt sure what their purpose is.
>
> Il giorno gio 7 feb 2019, 18:43 Eve Freeman <eve.fre...@gmail.com> ha
> scritto:
>
>> What's your schema? Do you have a unique constraint or index on the
>> labels + id you're merging on?
>>
>> Eve
>>
>> On Thu, Feb 7, 2019 at 12:23 PM <andrea.balz...@keypartner.it> wrote:
>>
>>> Hello everyone, i'm trying to MERGE thousands of nodes using UNWIND and
>>> apoc procedures (for a dynamic label creation) using Java Driver as follows:
>>>
>>>         String query =
>>>                 "UNWIND $nodes AS n " +
>>>                 "CALL apoc.merge.node([n.category], {id: n.id}, n)
>>> YIELD node RETURN node";
>>>         session.run( query, params );
>>>
>>>
>>> My database contains something like 150k nodes divided by 16 labels and
>>> 130k relationships of the same type. It worked fine so far, it never failed
>>> to deliver, but now that i'm trying to create something like 4k new nodes
>>> and 5k new relationships at once it took more than 30 minutes. I feel like
>>> it should be way faster than this.
>>>
>>> Am i doing anything wrong? Is it really supposed to be this slow? Is
>>> there anything i can do to make this process smoother and to improve
>>> performances?
>>>
>>> Thanks in advance
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Neo4j" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to neo4j+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to neo4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to