MATCH (n1:ACCOUNT)-[e]-{1,3}(n2:RULE) WHERE n1.account_id = ''ACC000000'' RETURN n1, n2 LIMIT 5
Why did this query cause an OOM?
No index pushdown/folding for repeating paths: The optimizer's Leapfrog Triejoin (try_ltj) doesn't support variable-length repeating patterns (-{1,3}). Therefore, it falls back to the general match execution path (run_match_chain).
Global path enumeration: In the fallback path, the sub-patterns are evaluated independently. Because the filter WHERE n1.account_id = 'ACC000000' is only evaluated after the pattern matching step completes, the engine is forced to evaluate -[e]-{1,3} (all paths of length 1, 2, and 3) globally across the entire 57MB database first with no limit.
Exponential explosion: In a highly connected transaction graph, the number of paths of length 3 grows exponentially to tens of millions or billions of combinations in memory. This exhausts the system memory, causing the Linux kernel OOM killer to terminate the process.
MATCH (n1:ACCOUNT)-[e]-{1,3}(n2:RULE) WHERE n1.account_id = ''ACC000000'' RETURN n1, n2 LIMIT 5
Why did this query cause an OOM?
No index pushdown/folding for repeating paths: The optimizer's Leapfrog Triejoin (try_ltj) doesn't support variable-length repeating patterns (-{1,3}). Therefore, it falls back to the general match execution path (run_match_chain).
Global path enumeration: In the fallback path, the sub-patterns are evaluated independently. Because the filter WHERE n1.account_id = 'ACC000000' is only evaluated after the pattern matching step completes, the engine is forced to evaluate -[e]-{1,3} (all paths of length 1, 2, and 3) globally across the entire 57MB database first with no limit.
Exponential explosion: In a highly connected transaction graph, the number of paths of length 3 grows exponentially to tens of millions or billions of combinations in memory. This exhausts the system memory, causing the Linux kernel OOM killer to terminate the process.