APOC vs CYPHER

what is the different between operation in APOC or CYPHER in terms of performance
ex:
CALL apoc.search.node('{Person: "id",Person: "id"}','exact','5686743') YIELD node AS n2
MATCH (p:Person {id:"5686743"}) RETURN p

I created two files; file A with 10 lines of:
CALL apoc.search.node('{TestPerson: "id",TestPerson: "id"}','exact','5686743') YIELD node AS n2

and file B with 10 lines of:

MATCH (p:TestPerson {id:"5686743"}) RETURN p

then I ran each script in the Neo4J terminal of a test database with:

time cat A | ./cypher-shell -u neo4j -p nope

and

time cat B | ./cypher-shell -u neo4j -p nope

A: 0m1.063s, 0m1.026s, 0m1.029s
B: 0m1.033s, 0m1.021s, 0m1.030s

To be really conclusive we would need to test more, my assumption is that the time you see is mostly the overhead of initialising the cypher-shell java environment and authenticating to the database.

I would use Cypher where possible and APOC where needed. If you hit bottlenecks in performance its probably neither APOC or Cypher but the complexity of the data.

1 Like

Thank you very much i will make some test on larger data sets
And i will keep you up to date