Cypher vs traversal framework

70 views
Skip to first unread message

Luanne Coutinho

unread,
May 29, 2012, 9:36:23 AM5/29/12
to ne...@googlegroups.com
Hi,

I have a fairly complication query where I've got to match 6 different ordered paths from a node, with some sub-paths being optional. Since these paths are either/or, together with optional parts and a lot of property matching, I decided to write 5 queries that represent these paths. 

My question is, in cases like this, what is the recommended option for considerations such as performance- a set of 5 queries which I union in the client, or a traversal starting from the given node, evaluating paths, and finally property matching on the end node of the paths included? Or a mixed solution where I identify the end nodes via a traversal and a cypher query to actually filter them based on the property matching? The traversal certainly seems easier to read in this case- the queries turned out to be pretty complicated- but performance is something I am not very sure about.

What would you recommend?

Thanks
Luanne

Peter Neubauer

unread,
May 30, 2012, 2:16:22 AM5/30/12
to ne...@googlegroups.com
Mmh,
I would say that the traversal framework (and possibly Gremlin) are
your fine-tuning performance options, while of course being a bit more
verbose to write than Cypher.

Do you think you could write the query and check performance first in
Cypher, and if necessary drop down a level of abstraction?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

If you can write, you can code - @coderdojomalmo
If you can sketch, you can use a graph database - @neo4j

Luanne Coutinho

unread,
May 30, 2012, 4:29:31 AM5/30/12
to ne...@googlegroups.com
Yeah I have the queries, just need a lot of data to be created for performance testing. Wasn't sure whether I should put in the time to write the traversal if there were not going to be substantial gains. Still, might just write it and keep it ready before we hit performance testing.

Thanks
Luanne

Peter Neubauer

unread,
May 31, 2012, 2:30:19 PM5/31/12
to ne...@googlegroups.com
Yeah.
right now, Cypher has no extensive performance testing. However, there
will be soon a lab project where we implement the Neo4j API (maybe
even some traversals) with it and then run the normal benchmarks
against a Cypher-backed API. That should give us at least a hunch on
the difference.

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

If you can write, you can code - @coderdojomalmo
If you can sketch, you can use a graph database - @neo4j


Reply all
Reply to author
Forward
0 new messages