Creating sharded property databases

You can create a sharded property database using the Cypher command CREATE DATABASE (requires Cypher 25, introduced alongside Neo4j 2025.06.0). For details on configuring the Cypher version, see Configure the Cypher default version.

Syntax

Command Syntax

CREATE DATABASE

CREATE DATABASE name [IF NOT EXISTS]
[[SET] DEFAULT LANGUAGE CYPHER {5|25}]
[[SET] GRAPH SHARD {
  [TOPOLOGY n PRIMAR{Y|IES} [m SECONDAR{Y|IES}]]
}]
[SET] PROPERTY SHARD[S] {
  COUNT n [TOPOLOGY m REPLICA[S]]
}
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

When creating a sharded property database, the following are created:

  • A virtual sharded property database <name>.

  • A single graph shard with the name <name>-g000.

  • A number of property shards with the name <name>-p<index>, where <index> ranges from 000 to 999. The count property in SET PROPERTY SHARDS specifies the number of property shards.

CREATE OR REPLACE does not replace an existing sharded property database.

Options

The CREATE DATABASE command can have a map of options, e.g., OPTIONS {key: 'value'}. For sharded databases, only the options seedURI, seedConfig, seedSourceDatabase, seedRestoreUntil, and txLogEnrichment are supported. For details see Create databases → Options.

The folder notation for seedURI only works for backups, not dumps.

When specifying each artifact manually the key of the map is the name of the shard, where the graph shard name = databaseName-g000 and the property shards = databaseName-p000 with the last property shard name being databaseName-px where x = numShards -1.

For examples on how to create a sharded property database, see Online ingestion.

Default numbers for topology

The sharded property databases use the Neo4j cluster topology. Therefore, you need to consider how the following settings will affect the creation of your sharded property database. initial.dbms.default_primaries_count and initial.dbms.default_secondaries_count affect only the graph shard

Configuration setting Default value Valid values Description

initial.dbms.default_primaries_count

1

[1-11]

The initial default number of primaries for the standard databases. Initialized at the first DBMS startup. If the user does not specify the number of primaries in CREATE DATABASE, this value will be used unless overwritten by the dbms.setDefaultAllocationNumbers procedure.

initial.dbms.default_secondaries_count

0

[0-20]

The initial default number of secondaries for the standard databases. Initialized at the first DBMS startup. If the user does not specify the number of secondaries in CREATE DATABASE, this value will be used unless overwritten by the dbms.setDefaultAllocationNumbers procedure.

initial.dbms.default_property_shard_replica_count

1

[1-20]

The initial default number of replicas of property shards. Initialized at the first DBMS startup. If the user does not specify the number replicas of property shards in CREATE DATABASE, this value will be used unless overwritten by the dbms.setDefaultAllocationNumbers procedure.