Whoops, "if so" should be "if not".

On Thu, Feb 7, 2019 at 3:22 PM Eve Freeman <eve.fre...@gmail.com> wrote:

> Are the ids unique to each label? If so, maybe you can merge on one
> "inclusive" label and then add an additional category label, and  then you
> can have just one constraint. No idea what you're doing here, so giving my
> best guess.
>
> On Thu, Feb 7, 2019 at 2:40 PM Andrea Balzoni <
> andrea.balz...@keypartner.it> wrote:
>
>> That sounds like a lot of constraints or am i wrong?
>>
>> Il giorno gio 7 feb 2019, 20:19 Eve Freeman <eve.fre...@gmail.com> ha
>> scritto:
>>
>>> Yes. You would need to add a constraint for each label + id combination.
>>>
>>> On Thu, Feb 7, 2019 at 1:57 PM Andrea Balzoni <
>>> andrea.balz...@keypartner.it> wrote:
>>>
>>>> Sadly the ids i'm trying to add are not going to be necessarily unique,
>>>> hence why i'm using merge. I think i grasped what a constrant is, but i
>>>> cant say the same about indexes. So you are telling me that adding a
>>>> constraint on ids would make the query faster? Sorry about questions that
>>>> might sound stupid, but i'm fairly new to neo4j...
>>>>
>>>> Il giorno gio 7 feb 2019, 18:59 Eve Freeman <eve.fre...@gmail.com> ha
>>>> scritto:
>>>>
>>>>> One other note--if you know these are unique ids, you can avoid using
>>>>> merge, and just use create, which will be quicker still.
>>>>>
>>>>> On Thu, Feb 7, 2019 at 12:54 PM Eve Freeman <eve.fre...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> 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.
>>>>>
>>>> --
>>>> 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