5 Big Small Things I Love About Neo4j 2.2<
/h2>
Originally posted on Rik’s Blog
Today, Neo4j 2.2 was released. It was a good day – and everyone at Neo was really excited. This was a big release. It was not an easy one, as we redid large parts of the plumbing for Neo4j – and still provide customers a smooth transition path. It’s a pretty spectacular piece of software engineering, if you ask me – and it feels good to get that out the door. I know that I am very excited about it – and I am sure that our customers and users will be too.
That’s why I thought I would list the things that I really love about Neo4j 2.2 – from a users perspective. Sure the upgraded plumbing is fantastic – but what will users SEE when they get started with the new version? And what parts of that may or may not be as easy to uncover at first glance? Let’s take a look.
1. Getting started by :play-ing
A big focus for Neo as a product and solution, has been to make it easy and straightforward to get started with. That’s important, because as my friend and colleague Mark pointed out several times already, there is a learning curve that our users go through. Mark very cleverly noted that graphistas go through a phase where the learning curve is very steep – and everything seems really hard then. After that, things quickly get better and easier – and gradually people tend to fall deeply in love with the technology.
That’s why it’s so important to make that initial phase so nice and easy for users. And that’s why I am totally digging the :play command in the browser these days. By :play-ing (totally inline with the “playful learning” that you can apply to your kids), our users will be learning and getting into the technology as gently as possible. Here are a few examples:
:play query template
This command gives you access to some really nice and easy ways to input some data into Neo4j. it’s really sweet. Take it for a spin and input some straightforward data – it’s fun!
:play northwind graph
Another super-cool command, taking you through an example that most people know – the Microsoft Northwind relational database – and “migrating” that to a graph model, step by step. Love it!
:play sysinfo
Maybe a bit more advanced, but this is the first time that the Neo4j browser – which has traditionally been positioned as the developer’s Cypher playground – also gets some admin-style capabilities. No doubt this will be expanded in the future, but already this pane is really useful.
2. Query pane enhancements FTW!
In the new Neo4j browser, the query pane that displays the results of your queries, has been completely redesigned. Some of these features are minor cosmetic changes, but some are actually quite massive:
- The pane now allows you to cancel running Cypher queries. This is massive. With the simple click of a button on the X marker, you can now tell the Neo4j server that it should cancel/rollback the transaction that you just launched. Tremendously important for many users – previously you would sometimes just need to kill the server when transactions would spin out of control.
- Exporting data from the browser: it was always possible to export the view in the “graph view” to json files. But now you can do so much more. Especially the export to .png and .svg is useful for those of us that what to share query results with their colleagues. I love that.
- At the bottom of the Graph pane you now have this little slider: do you want to Auto-complete your graph, yes or no. This can be really, really useful. Auto-complete basically allows you to switch the browser from either showing ALL of the relationships between the subgraph in the resultset, or only showing those that you explicitly included in your “RETURN” statement. Super useful.
3. Additional Browser :commands
There’s two Browser commands that you may or may not yet know about, and I think they are really useful:
:style
This gives you access to the “grass” file that is applied to the browser. This GRAph Style Sheet will allow you to configure the visualization in detail. Normally you edit this file by making visualization choices in the query pane – but you can also download the file, edit in your favourite text editor, and re-load it by dropping it on the button below. Really easy.
:config
This one is interesting, as it gives you fine grained control on how the Browser web application (you should look at the “Browser” as an application that talks to the Neo4j REST API) behaves. You can see some of these parameters below:
And: you can edit some of these parameters too! For example, let’s say I want to edit the maximum number of rows returned by the Browser. Then you do:
:config maxRows:1000
and that parameter will be updated. Or let’s say you want to edit the maximum number of “neighbour” nodes displayed when you double-click a node in a pane:
:config maxNeighbours:1000
You obviously need to be careful with these parameters, as they can very easily screw with your browser stability – but still very useful.
4. Editing the GRASS file: Composite captions rule!
I already mentioned the GRASS file above, but I wanted to mention one of these things that I think will really enhance the Browser experience: the ability to create composite captions on the visualisations. What are these? Well let’s say that I have a subgraph with nodes that are labeled as :Respondent, and that they have a “name” property that holds an identifier. Well, if I want to create a visualisation that displays a Node caption that has the word “Respondent”+the “name” property in it, I can now do that by including
caption: ‘Identifier {name}’;
instead of
caption: ‘{name}’;
in the GRASS file. See the result below.
Or, let’s say that I would have TWO properties on these kinds of nodes: “name” and “age”. Well, then with the composite captions I can create a caption that combines both properties in one Node caption:
caption: ‘{name} aged {age}’;
Cool, huh? Really helpful, I think.
5. Query plans VISUALIZED!
As you may have learned, Neo4j now has a superfast new “cost based” query planner for Cypher. That’s super interesting, and has yielded massive performance enhancements over previous Neo4j Cypher planners – which were all rule based. What you may not know yet, is that the new Neo4j 2,2 Browser includes a fantastic way for users to understand and tune their queries, but visually showing you what happens to a query as it gets interpreted and executed. There’s two keywords that you want to remember to prefix your queries with:
- EXPLAIN will show you the query plan, but will not execute the query. Particularly helpful for “heavy” operations.
- PROFILE will show you the plan and also execute it – giving you a real world sense of the execution speed on a running database.
The basic rule here is of course that you want to keep the “database hits” as low as possible, and that you particularily want to avoid joins/products of large sets. That’s what kils performance on a RDBMS, and it can still kill performance in Neo4j too.
So there you go. 5 small big things, or big small things that I think will really matter for our users as they start playing with Neo4j 2.2. I have really enjoyed it so far – I am hoping that you guys will too!
Hope that was useful.
Cheers
Rik
Want to learn more about graph databases? Click below to get your free copy of O’Reilly’s Graph Databases ebook and discover how to use graph technologies for your application today.
Download My Ebook