Huge performance difference when returning relationship AND start node vs. relationship only


(Christian Morgner) #1

The following two queries differ in performance by about two orders of magnitude:

6 results, time: 0.000422085s
MATCH (n)<-[r:SECURITY]-() WHERE ID(n) = 108253 RETURN r

6 results, time: 0.031369832s
MATCH (n)<-[r:SECURITY]-(s) WHERE ID(n) = 108253 RETURN r, s


Is there any way to speed up the second query?

Thank you!

edit: Here are the relationship counts of the start nodes:
3313
3315
4673
5159
8975
6346


(Christian Morgner) #2

I found the reason: some of the start nodes contain a very large string property which takes several milliseconds to transfer. The performance is as expected when the property value is set to null.

This post can be deleted (I don't have permission to delete the topic and I was not able to find the suggested "flag for moderator attention" in the user interface, so please delete this topic for me.)


(Craig Taverner) #3

I'm thinking that issues like this would make more sense on the github issue tracker where we can close issues when they are either fixed (or as in this case the original problem is discovered to be different). I think the community site is more for question/answer discussions? I agree that the difference can be quite subtle though.


(Craig Taverner) #4

(Craig Taverner) #5

But I found a way to close it anyway, so all is good! :slight_smile: