Neo4j.rb RubyTapas-inspired screencast series

Co-maintainer of Neo4j.rb alongside Brian here! Offhand, I'm not aware of any resources that explain it but I might be able to give you some tips. Various thoughts and anecdotes are below that might help you and others make some decisions.

Off the bat, there are a few things that Neo4j just doesn't do very well. It's not at all optimized for binary storage. It wouldn't be my choice for high-volume numerical data that may benefit from DB-provided mathematical functions -- financials, basically. It has a few mathematical functions but it just doesn't compare to Postgres at all. Returning single records or non-relational queries is significantly slower than Postgres. "Match all Users of age 30"-types of queries, even when the properties you're searching against are indexed, are much slower. I'm confident that will change in the future but for now, it's worth being aware of. People say that time-series data isn't good for Neo4j but I'm not sure that I agree with that when Neo4j TimeTree is such a great option.

So with the caveats out of the way, where they claim it really shines is on relational data. A "friends of friends of friends" types of queries that are typically very expensive in SQL are often trivial in Neo4j. Data modeling is logical, the query language is wildly simple to get started with but deceptively powerful once you start digging. Queries are also very very very very easy to read, usually, and even complex queries will usually still make sense when you come back to them a few days or weeks later, which I do not find true for SQL.

I recently introduced a team of three other devs, two junior and one very senior, to Neo4j and Neo4j.rb. We rebuilt our company's CMS, moving from Rails and Postgres to Sinatra and Neo4j. It seems like the experience was extremely positive. The modeling was a dream, the web console is a wonderful learning and demonstration and sanity-checking tool, and the speed with which we're able to change our modeling to reflect changing requirements within the app made things easier than it would have been otherwise. I think the flexibility of the data model might have been the greatest asset. There were some hiccups along the way: bugs in the gem, a brutal bug in the query language, some slow tests, some new patterns to figure out, some frustration with ActiveRecord-like features that are still missing in the gem... but I think that the pros outweighed the cons.

Anecdotally, most performance issues that are reported to Neo4j.rb directly or through Stack Overflow seem to be the result of users expecting magic. "I have 10 million nodes describing users and their purchases. I want to find every user who purchased a red apple but did not purchase a green apple and has two friends who purchased the green apple, then I want to return them all at the same time. Why does it take longer than 100ms?" That sort of thing comes up a lot. There is a certain art to modeling for the graph and crafting queries, so I always recommend that users be patient, experiment a lot, and do some reading before they start diving in.

Gonna cut this off here. TL;DR: use it for highly relational stuff. Great for startups who want to model fast, build fast, change directions on a dime; not great for financials or binary storage.

/r/ruby Thread Parent Link - youtube.com