You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Query 1: MATCH (s3:Computer)<--(s4:HighValue)-->(s0:Computer)-->(s2:User)--()-->(s1:User)<--() RETURN s3 ORDER BY id(s3) ASC SKIP 4 LIMIT 6
Response time: ready to start consuming query after 100 ms, results consumed after another 0 ms
Query 2: OPTIONAL MATCH (s3:Computer)<--(s4:HighValue)-->(s0:Computer)-->(s2:User)--()-->(s1:User)<--() RETURN s3 ORDER BY id(s3) ASC SKIP 4 LIMIT 6
Response time: ready to start consuming query after 97 ms, results consumed after another 201287 ms
Adding OPTIONAL in Query 2 unexpectedly makes the execution more than 2000x times slower : (
Hello @YuanchengJiang, thank you again for reporting this! I've investigated the issue and concluded that he reason why we pick a worse plan in the OPTIONAL MATCH case is because of an incorrect assumption encoded in the planner regarding ORDER BY combined with OPTIONAL MATCH. I've addressed the issue in a PR and the fix should be present in the next release of Neo4j 5.
Neo4j version: 5.4.0
Operating system: Ubuntu 20.04
API/Driver: Cypher
Dataset: https://github.com/neo4j-graph-examples/cybersecurity
Query 1:
MATCH (s3:Computer)<--(s4:HighValue)-->(s0:Computer)-->(s2:User)--()-->(s1:User)<--() RETURN s3 ORDER BY id(s3) ASC SKIP 4 LIMIT 6
Response time: ready to start consuming query after 100 ms, results consumed after another 0 ms
Query 2:
OPTIONAL MATCH (s3:Computer)<--(s4:HighValue)-->(s0:Computer)-->(s2:User)--()-->(s1:User)<--() RETURN s3 ORDER BY id(s3) ASC SKIP 4 LIMIT 6
Response time: ready to start consuming query after 97 ms, results consumed after another 201287 ms
Adding OPTIONAL in Query 2 unexpectedly makes the execution more than 2000x times slower : (
Query 1 Profile:
Query 2 Profile:
The text was updated successfully, but these errors were encountered: