Neo4j databases and graphs

Cypher® queries are executed against a Neo4j database, but normally apply to specific graphs. It is important to understand the meaning of these terms and exactly when a graph is not a database.

  • DBMS

    • A Neo4j server is a Database Management System capable of containing and managing multiple databases. Client applications will connect to a database server and be able to open sessions against a particular database.

  • Database

    • A database is a storage and retrieval mechanism for collecting data in a defined space on disk and in memory. A client session provides access to a single database in the DBMS. Cypher commands executed through this session will apply to the default graph within that database. It is never possible to operate against multiple databases at the same time. Transactions are specific to a database.

  • Graph

    • This is a data model within a database. In Neo4j 4.0 there is only one graph within each database, and many administrative commands that refer to a specific graph do so using the database name.

    • In Neo4j 4.0 Fabric it is possible to refer to multiple graphs within the same transaction and Cypher query.

Most of the time Cypher queries are reading or updating queries which are run against a graph. There are, however, administrative commands that apply to a database, or to the entire DBMS. Such commands cannot be run in a session connected to a normal user database, but instead need to be run within a session connected to the special system database.

More on this requirement is described in the chapter on Administration.

The System Database and the Default Database

All Neo4j servers will contain a built-in database called system which behaves differently than all other databases. In particular, when connected to this database you can only perform a specific set of administrative functions, as described in detail in the section on administration. Most of the available administrative commands can only be run by users with specific administrative privileges. Information on configuring the security privileges is described in the Operations Manual as well as the section below on security commands.

A fresh installation of Neo4j will include two databases:

  • system - the system database described above, containing meta-data on the DBMS and security configuration.

  • neo4j - the default database, named using the config option dbms.default_database=neo4j.

Different editions of Neo4j

Neo4j has two editions, a commercial Enterprise Edition with additional performance and administrative features, and an open-source Community Edition. Cypher works almost identically between the two editions, and as such most of this manual will not differentiate between them. In the few cases where there is a difference in Cypher language support or behaviour between editions, these are highlighted as described below in Limited Support Features.

However it is worth listing up-front the key areas that are not supported in the open-source edition:

Feature Enterprise Community

Multi-database

Any number of user databases

Only system and one user database

Role-based security

User, Role and Privilege management for flexible access control and sub-graph access control.

Multi-user management. All users have full access rights.

Constraints

Existence constraints and multi-property NODE KEY constraints.

Only single property uniqueness constraints

Limited Support Features

Some elements of Cypher do not work in all deployments of Neo4j, and we use specific markers to highlight these cases:

Marker Description Example

deprecated

This feature is deprecated and will be removed in a future version

DROP INDEX ON :Label(property)

enterprise-only

This feature only works in the enterprise edition of Neo4j

CREATE DATABASE foo

fabric

This feature only works in a fabric deployment of Neo4j.

USE fabric.graph(0)