jrgemignani commented on issue #1902: URL: https://github.com/apache/age/issues/1902#issuecomment-2289777931
@sanket-uptycs We are looking into performance improvements in general. I will point out that the below query is a bit redundant by using MERGE and SET. MERGE is basically MATCH X and if X doesn't exist CREATE X. Since you have already MATCHed them, you don't need to do it again. Additionally, since you are creating a new edge, you don't need to SET it. ``` SELECT * FROM cypher('graphdb', $$ MATCH (n1:node1 {SubscriptionId: "8da31d20-daf9-42ad-bf7f-2cdcf6290001"}) MATCH (n2:node2 {SubscriptionId: "8da31d20-daf9-42ad-bf7f-2cdcf6290001"}) UNWIND n1.ArrayOfStrings as props WITH props, n1, n2 WHERE toLower(props) = toLower(n2.ResourceId) MERGE (n1{SubscriptionId: "8da31d20-daf9-42ad-bf7f-2cdcf6290001"})-[r:ATTACHED_TO{SubscriptionId: "8da31d20-daf9-42ad-bf7f-2cdcf6290001"}]->(n2{SubscriptionId: "8da31d20-daf9-42ad-bf7f-2 cdcf6290001"}) SET r.batchId = 1717068002, r.SubscriptionId = "8da31d20-daf9-42ad-bf7f-2cdcf6290001" $$) as (a agtype); ``` I believe this is equivalent, and likely faster - ``` SELECT * FROM cypher('graphdb', $$ MATCH (n1:node1 {SubscriptionId: "8da31d20-daf9-42ad-bf7f-2cdcf6290001"}) MATCH (n2:node2 {SubscriptionId: "8da31d20-daf9-42ad-bf7f-2cdcf6290001"}) UNWIND n1.ArrayOfStrings as props WITH props, n1, n2 WHERE toLower(props) = toLower(n2.ResourceId) CREATE (n1)-[r:ATTACHED_TO{SubscriptionId: "8da31d20-daf9-42ad-bf7f-2cdcf6290001", batchId: 1717068002}]->(n2) $$) as (a agtype); ``` -- 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: dev-unsubscr...@age.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org