怎么优化 MATCH多个的 合并
发布于 4 年前 作者 q1021954457 1271 次浏览 来自 问答

MATCH (a:ApplyBomDetail) ,(b:ApplyBomDetail) where a.product_id=b.upper_product_id AND a.account_id=1 AND b.account_id= 1 MERGE (a)-[p:Parent{upper_level_quantity: b.upper_level_quantity ,current_level_quantity: b.current_level_quantity }]->(b)

这个语句效率超级慢,有什么优化的吗?? 特别是 MATCH (a:ApplyBomDetail) ,(b:ApplyBomDetail) 这段

2 回复

头上加profile 关键字分析下

尽量不要用match (a),(b)这样检索,因为很有可能会笛卡尔积。 改成 MATCH (a:ApplyBomDetail) where a.account_id=1 with a match (b:ApplyBomDetail) where a.product_id=b.upper_product_id AND b.account_id= 1 然后在account_id,upper_product_id,product_id加上索引

回到顶部