Open sanket-uptycs opened 3 months ago
This issue is stale because it has been open 60 days with no activity. Remove "Abondoned" label or comment or this will be closed in 14 days.
This issue was closed because it has been stalled for further 14 days with no activity.
@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);
I am trying following query. Can we improve query performance?
I have gin index on node1 node2 and ATTACHED_TO edge. But it is taking
Planning Time: 0.309 ms Execution Time: 44548.615 ms
Here is the query plan.select count(*) from graphdb._ag_label_edge; | 324030 |
select count(*) from graphdb._ag_label_vertex; | 220385 | Number of Node and Edge types : 50+