Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-09-2023 04:24 AM
Hi
I am trying to insert multiple records in neo4j
I have two types of nodes
both can have relation with itself and other
but when i try to insert multiple records in one type its taking too long and cpu consumption also goes upto 150%
can you please suggest me all ways that I can implement to make my queries faster
01-09-2023 05:38 AM
Can you post the query and your indexes?
01-18-2023 04:03 AM
Hi Team
this is my query
`WITH $batch as batch\n`+
`UNWIND batch as row\n`+
`MATCH (asset:ASSET {uniqueID: row.asset}), (event:EVENT {uniqueID: row.event, eventId: row.eventId })\n`+
`CREATE (event)<-[:HAS_EVENT]-(asset)`
i am create around 50 60 relations like this
but this is taking 1 to 2 minutes
and cpu consumption also goes 100 plus
i did indexing as well
like this
CREATE TEXT INDEX FOR (n:ASSET) ON (n.uniqueID)
i created index for all labels like this
on dashboard this is giving result in 1 millsecond
but from code it is taking lot of time
can you please suggest some better way to optimize this
or suggest some better indexing
I'm using version 4.4
of both neo4j and driver
01-18-2023 06:23 AM
Your second match has two properties. do you really need both properties to uniquely identify the node? UniqueId is not enough? If you need both, try adding a composite index on both properties to see if the search is better.
Can you post the 'Explain' plan for the query? Maybe the index is not being used?
01-24-2023 03:35 AM
Hi now i have 1M records and to insert, match and create relation between 100 nodes it taking 10 minutes at least
these are the indexes i created
and i creating data with these queries
query1
query 2
01-24-2023 03:58 AM
query 5
01-24-2023 04:00 AM - edited 01-24-2023 04:04 AM
How large are the batches, i.e., how may rows? Is it one million rows? If so, you should use ‘call subquery in transactions’ or apoc.periodic.iterate to group the transactions in to batches of 50,000 or so.
01-24-2023 04:10 AM
No batch size is only 50 to 100
and only query 5 is taking too much time
can you please help me that
All the sessions of the conference are now available online