humzakt commented on issue #918:
URL: https://github.com/apache/age/issues/918#issuecomment-1546659620

   In Apache AGE, you can indeed insert multiple edges in a single Cypher query 
which can help optimize the operation. The Cypher query language used in AGE 
allows the creation of multiple relationships (edges) in a single command. 
Below is an example of how you can do this:
   
   Assuming you have two sets of nodes:
   ```
   CREATE (a:Person {name: 'John'}), (b:Person {name: 'Jack'}), (c:Person 
{name: 'Jill'})
   CREATE (x:Location {name: 'New York'}), (y:Location {name: 'Los Angeles'}), 
(z:Location {name: 'Chicago'})
   ```
   
   You can create multiple edges in a single command as follows:
   
   ```
   MATCH (a:Person {name: 'John'}), (b:Person {name: 'Jack'}), (c:Person {name: 
'Jill'})
   MATCH (x:Location {name: 'New York'}), (y:Location {name: 'Los Angeles'}), 
(z:Location {name: 'Chicago'})
   CREATE (a)-[:VISITED]->(x), (b)-[:VISITED]->(y), (c)-[:VISITED]->(z)
   ```
   
   In the above example, three edges are created in a single Cypher command. 
This is more efficient than creating them one by one. Make sure to use indexes 
on properties that are used often in MATCH clauses to further speed up the 
process.
   
   However, please note that if you're trying to add a large number of edges at 
once, you might hit transaction size limits depending on your PostgreSQL 
configuration. In such cases, you may need to batch the operations or adjust 
your PostgreSQL configuration.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to