cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Apoc.case look for more rows as shown by profile than normal query

Hi,

I need to run a query with apoc.case(..) and this seem to take more time to return results. Executing a particular case query, return results quickly. To show what is happening, I came up with following example -

EXPLAIN
CALL apoc.case([2 = 2, "Match (:User {id: 'cjpqf666w0000ea54iezc4xvs'}) "], '', {}) yield value
RETURN 0

This seem to be operating on more rows as shown by ProcedureCall, Projection and ProduceResults step.

And following query -

EXPLAIN
Match (:User {py_tiny_id: 'cjpqf666w0000ea54iezc4xvs'})
RETURN 0

just operate on 1 row and return quickly.

Is this a bug with apoc.case ?

-Karthik

1 REPLY 1

I'm not quite sure I'm following.

Keep in mind that when you do EXPLAIN, you get estimated rows, which is a completely different thing than actual rows, and often the planner can't infer what it's going to find and it makes a best guess.

Try using PROFILE instead.

That said, when procedure calls are involved, we don't get db hit and row data from what happened within the procedure.

Also, your example shouldn't be valid, as you can't have a query that consists solely of a MATCH, you need a RETURN in there.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online