Performing match intersection

Match intersection is a common use case where you’re searching for nodes which have relationships to all of a set of input nodes. For the rest of the article we’ll use the built-in movies graph for demonstration. The example use… Read more →

Explore:  


Updating a node but returning its state from before the update

Some use cases require updating node (or relationship) properties, but returning the node (or relationship) as it was prior to the update. You’ll need to get a ‘snapshot’ of the node before the update, and return that snapshot instead of… Read more →

Explore:  


Why doesn’t my WHERE clause work?

It can be frustrating when it seems like a WHERE clause isn’t working. You can use these approaches to figure out what’s wrong. Check for WHERE clauses following OPTIONAL MATCH WHERE clauses can’t be used on their own, they are… Read more →

Explore:  


Understanding how MERGE works

What is MERGE, and how does it work? The MERGE clause ensures that a pattern exists in the graph. Either the pattern already exists, or it needs to be created. In this way, it’s helpful to think of MERGE as… Read more →

Explore:  


How do I quickly identify long gc pauses via the messages or debug logs

Java Garbage Collection (gc) pauses are monitored by the MonitorGc process in Neo4j, and recorded in the $NEO4J_HOME/logs/debug.log ( or $NEO4J_HOME/data/graph.db/messages.log for Neo4j v2.3.x and prior). To quickly find the 10 longest pauses in Neo4j 3.0 through Neo4j 3.3 one… Read more →

Explore:  


Debian / Ubuntu: How to enforce a certain version of neo4j when using debian packages

If you want to run a specific version of Neo4j and install the software via a debian repository you need to use a technique called apt pinning. Otherwise any system update will also update Neo4j to its latest stable version.… Read more →

Explore:  


Fast counts using the count store

Neo4j maintains a transactional count store for holding count metadata for a number of things. The count store is used to inform the query planner so it can make educated choices on how to plan the query. Obtaining counts from… Read more →

Explore:  


Resetting query cardinality

As queries execute, they build up result rows. Cypher executes operations per-row. When a query is made up of completely separate parts, unrelated to each other, and you don’t want to split the single query into multiple queries, you sometimes… Read more →

Explore:  


Post-UNION processing

Cypher does not allow further processing of UNION or UNION ALL results, since RETURN is required in all queries of the union. Here are some workarounds. Post-UNION processing in Neo4j 4.0 With Neo4j 4.0, post-UNION processing is now possible via… Read more →

Explore:  


Tuning Cypher queries by understanding cardinality

Cardinality issues are the most frequent culprit in slow or incorrect Cypher queries. Because of this, understanding cardinality, and using this understanding to manage cardinality issues, is a critical component in Cypher query tuning, and query correctness in general. A… Read more →

Explore:  


Understanding Neo4j’s data on disk

Neo4j database files are persisted to storage for long term durability. Data related files located in data/databases/graph.db (v3.x+) by default in the Neo4j data directory. Below will give you an idea of the type of files you’ll find, prefaced with… Read more →

Explore:  


Using apt to download a specific Neo4j debian package

By default, using apt-get to install Neo4j allows you to grab the current and previous stable releases. However, if you would like to install an older version, you can specify that. For reference, the Debian repo is located here: http://debian.neo4j.org/… Read more →

Explore:  


Large Delete Transaction Best Practices in Neo4j

In order to achieve the best performance, and avoid negative effects on the rest of the system, consider these best practices when processing large deletes. Start by identifying which situation you are in: Deleting the entire graph database, so you… Read more →

Explore:  


Enabling GC Logging

What is Garbage collection and why enabling it? A garbage collection event is a complete pause of the java application (ie: neo4j-server). It can be identified in the debug.log as a stop-the-world event. For example: If you notice issues with… Read more →

Explore:  


Achieving longestPath Using Cypher

While Cypher is optimized for finding the shortest path between two nodes, with such functionality as shortestPath(), it does not have the same sort of function for longest path. In some cases, you may want this, and not the shortest… Read more →

Explore:  


Understanding memory consumption

So you have configured Neo4j to use 4GB of heap and 6GB of page cache and sat back relaxed, thinking the Java process would not go above 10GB in your 12GB machine only to realise that Neo4j had an OOM… Read more →

Explore:  


How do I define a LOAD CSV FIELDTERMINATOR in hexidecimal notation

When using LOAD CSV one can define the field delimiter used, whereby the default is the ‘,’ character. If you want to override the default this can be accomplished via the paramter FIELDTERMINATOR, for example LOAD CSV WITH HEADERS from… Read more →

Explore:  


How do I run Consistency Check Manually?

If you skip the Consistency Check part of neo4j-backup, or you want to check that all is well with a data store, you can run the tool against an offline store. $ java -cp ‘lib/*:system/lib/*’ org.neo4j.consistency.ConsistencyCheckTool /tmp/graph.db On a Windows… Read more →

Explore:  


Explanation of error “WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver…​

In Neo4j 3.0 and its implementation of the Bolt protocol, if a remote browser connects to Neo4j (http://<remote_neo4j_host>:7474) and attempts to authenticate, the following error may be encountered: WebSocket connection failure. Due to security constraints in your web browser, the… Read more →

Explore:  


A note on OPTIONAL MATCHes

An OPTIONAL MATCH matches patterns against your graph database, just like a MATCH does. The difference is that if no matches are found, OPTIONAL MATCH will use a null for missing parts of the pattern. OPTIONAL MATCH could be considered… Read more →

Explore:  


How do I achieve the equivalent of a SQL Having clause with Cypher

With a traditional SQL based database a HAVING clause will restrict aggregated values. For example select zipcode, count(*) as population from Person group by zipcode having population>100000; will return all zipcodes which have more than 100k residents. To achieve the… Read more →

Explore:  


java.lang.OutOfMemoryError: unable to create new native thread

When a client application establishes a session with a Neo4j server via the bolt or bolt+routing protocols, the server allocates a thread to serve as the server-side bolt worker to handle that connection. There is no server-side limitation on the… Read more →

Explore:  


Explanation of error “Database constraints have changed (txId=xxxxx) after this transaction (txId=yyyyy) started, which is not yet supported”

The following error, via bin/neo4j-shell: Database constraints have changed (txId=84) after this transaction (txId=81) started, which is not yet supported. Please retry your transaction to ensure all constraints are executed. or as logged in log/debug.log (3.x) or graph.db/messages.log (2.3.x): 2016-10-18… Read more →

Explore:  


Redirect Neo4j logs to sysout (using rsyslog)

Sometimes – due to organizational requirements, security, indexing or plain convenience – we want to output all of our application logs to Linux’s sysout. While Neo4j doesn’t offer this feature, we can use RSYSLOG (www.rsyslog.com) to achieve that and we… Read more →

Explore:  


How do I enable remote HTTPS access with Neo4j 3.0.x

With 3.0.x to enabled remote clients to connect to a HTTPS enabled browser the following parameters in the $NEO4J_HOME/conf/neo4j.conf need to be changed from the default of #dbms.connector.https.address=localhost:7473 to dbms.connector.https.address=0.0.0.0:7473 The change from localhost:7473 to 0.0.0.0:7473 will allow for remote… Read more →

Explore: