Solving the “Store copy failed due to store ID mismatch” error

It is possible that after seeding a cluster or restoring from a backup, you may encounter the following error while starting your cluster: ERROR [o.n.c.c.s.s.CoreStateDownloader] Store copy failed due to store ID mismatch In most of the cases, this issue… Read more →

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 →

Creating and working with linked lists in Cypher

At some point when working with a graph, you may want to create a linked list out of some nodes. If each of the nodes to be linked has its own variable, this is easy, you just do a CREATE… Read more →

Conditional Cypher Execution

At some point you’re going to write a Cypher query requiring some conditional logic, where you want different Cypher statements executed depending on the case. At this point in time Cypher does not include native conditional functionality to address this… Read more →

Alternatives to UNION queries

While UNIONs can be useful for certain cases, they can often be avoided completely with small changes to the query. In this article we’ll present various example cases where a UNION isn’t necessary, and a simple Cypher query will do.… Read more →

Using AWS CLI to upload/download files to Amazon S3 bucket

If one has installed the AWS CLI To download a file from a S3 bucket anonymously run aws s3 cp s3://<AWS instance name>/<bucket_Name>/<file> <file> –no-sign-request and/or to upload to a Neo4j S3 buck anonymously run aws s3 cp <file> s3://<AWS… Read more →

Linux Out of Memory killer

The Out Of Memory Killer or OOM Killer is a process that the linux kernel employs when the system is critically low on memory. This situation occurs because the linux kernel has over allocated memory to its processes. When a… Read more →

Using apoc.load.jsonParams to load data from Zendesk into Neo4j to learn about article subscribers

The following document describes how to utilize the Zendesk API to load data from Zendesk into Neo4j, specifically data about users who have choosen to subscribe/follow Knowledge Base section(s). This document attempts to solve the issue described by the following… Read more →

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 →

How does apoc.periodic.iterate work with resources?

How does apoc.periodic.iterate work? For example, when running call apoc.periodic.iterate(“MATCH (n) RETURN n”, “DETACH DELETE n”, {batchSize:1000}) does it append a LIMIT to the MATCH RETURN so that it only returns the batchSize or does it return everything but it… Read more →

How to avoid using excessive memory on deletes involving dense nodes

In situations where you know you need to delete a bunch of nodes (and by rule their relationships as well), it can be tempting to simply use DETACH DELETE and be done with it. However, this can become problematic if… Read more →

How do I establish a simple HTTP Server local to my Neo4j Instance to serve CSV files

When using LOAD CSV one can define the source file to be either at a local file system (i.e load csv from ‘file:///…​’ ) or a webserver ( i.e. load csv from ‘http://…​’). Usage of a webserver might be a… Read more →

Neo4j: Convert string to date

Neo4j 3.4 saw the introduction of the temporal date type, and while there is now powerful in built functionality, converting strings to dates is still a challenge. If our string is in the format yyyy-MM-dd we can call the date… Read more →

Preserving the Neo4j pagecache across database restarts

Commencing with Neo4j 3.4 and as a result of PR 10957, and when using Neo4j Enterprise the Neo4j pagecache will be preserved across database restarts and as such a need to pre-warm the pagecache may no longer be needed. As… Read more →

Using explicit indexes for text search

Please note that in Neo4j 3.5 FullText search is available in Neo4j as part of Cypher stored procedures. More documentation is found here: https://neo4j.com/docs/cypher-manual/3.5/schema/index/#schema-index-fulltext-search. As of Neo4j 3.4.x, the schema index is optimal for indexing exact property values, but does… Read more →

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 →

Neo4j’s commit process explained

This article will try to guide you through Neo4j’s commit and replication processes both for single instances and causal clusters.   Single Instance When you call tx.commit(), the transaction will go through the Storage Engine which will transform that transaction… Read more →

Database was successfully initialized, but failed to start

Sometimes when the database does not start it could be something as simple as unnecessary characters in the neo4j.conf file. For example if you add space and/or tab characters to below setting: dbms.ssl.policy.client_policy.private_key=/var/lib/neo4j/certificates/client_policy/neo4j.key The database will fail to start and… Read more →

How to check for time range overlap in Cypher

Neo4j 3.4 introduced temporal types into Cypher, so now we have dates, dateTimes, and their local versions, too, as well as durations. While we don’t have a type for time ranges, we can use two temporal instants as the start… Read more →

Understanding causal cluster size scaling

The ability to safely scale down the size of a causal cluster affords us more robustness for instance failures, provided we maintain quorum as the failures take place. Prior to 3.4, we used a single config property to define both… Read more →

How to Setup Neo4j to Startup on Linux Server Reboot

If you want to emulate the Neo4j RPM service with a tar installation on Linux systems, do the following steps: As root: Copy the $NEO4J_HOME/bin/neo4j script file to /etc/init.d Edit the /etc/init.d/neo4j script file to uncomment the NEO4J_HOME variable and… Read more →

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 →

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 →

Why do my deleted property keys appear?

When using the Neo4j Browser and selecting the left frame and top icon entitled Database Information or using the built in stored procedure db.propertyKeys() you may see property keys which are no longer associated with any nodes. This is expected.… Read more →

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 →