Skip to content

Commit dfb9e2a

Browse files
committed
Updates to CREATE DATABASE for Cypher 25
* Explain how existing store files work, this has never really been well documented * Add a different set of options for Cypher 25 * WAIT is different in Cypher 25.
1 parent d14220d commit dfb9e2a

File tree

1 file changed

+87
-1
lines changed

1 file changed

+87
-1
lines changed

modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For more information, see link:{neo4j-docs-base-uri}/upgrade-migration-guide/upg
1818
[[create-neo4j-database]]
1919
== Create databases
2020

21-
You can create a database using the Cypher command `CREATE DATABASE`.
21+
You can create a database using the Cypher command `CREATE DATABASE`. The initial contents of the database will depend on the state of the server and the options provided to the command. When no additional options are provided, `CREATE DATABASE` will attempt to mount any pre-existing store files in place (e.g. as the result of restoring a backup). If no pre-existing store files are available, an empty database will be created.
2222

2323
[NOTE]
2424
====
@@ -64,6 +64,11 @@ CREATE OR REPLACE DATABASE name
6464
[[manage-databases-create-database-options]]
6565
=== Options
6666

67+
[.tabbed-example]
68+
=====
69+
[.include-with-cypher5]
70+
======
71+
6772
The `CREATE DATABASE` command can have a map of options, e.g. `OPTIONS {key: 'value'}`.
6873

6974
[options="header"]
@@ -128,7 +133,57 @@ Starting from Neo4j 2025.01, you can use `existingData`, `seedURI`, `seedConfig`
128133
The `existingDataSeedInstance` and `existingDataSeedServer` are still not supported with the `CREATE OR REPLACE DATABASE` command.
129134
More details about seeding options can be found in xref::clustering/databases.adoc#cluster-seed[Seed a cluster].
130135
====
136+
======
137+
[.include-with-cypher25]
138+
======
139+
The `CREATE DATABASE [OR REPLACE]` command can have a map of options, e.g. `OPTIONS {key: 'value'}`.
140+
141+
[options="header"]
142+
|===
143+
144+
| Key | Value | Description
145+
146+
|`existingDataSeedServer`
147+
| ID of the cluster server
148+
|
149+
Defines which server is used for seeding the data of the created database.
150+
The server ID can be found in the `serverId` column after running `SHOW SERVERS`.
151+
Replaced by `existingDataSeedServer`.
152+
153+
| `seedURI`
154+
| URI to a backup or a dump from an existing database.
155+
|
156+
Defines an identical seed from an external source which will be used to seed all servers.
157+
158+
| `seedConfig`
159+
| Comma-separated list of configuration values.
160+
|
161+
For more information see xref::clustering/databases.adoc#cluster-seed-uri[Seed from URI].
131162

163+
| `txLogEnrichment`
164+
| `FULL` \| `DIFF` \| `OFF`
165+
|
166+
Defines the level of enrichment applied to transaction logs for Change Data Capture (CDC) purposes.
167+
168+
For details about enrichment mode, see link:{neo4j-docs-base-uri}/cdc/current/get-started/self-managed/#set-enrichment-mode/[Change Data Capture Manual -> Enable CDC on self-managed instances -> Set the enrichment mode].
169+
170+
| `storeFormat`
171+
| `aligned` \| `standard` \| `high_limit` \| `block`
172+
|
173+
Defines the store format if the database created is new.
174+
`high_limit` and `standard` formats are deprecated from 5.23.
175+
For more information on store formats, see xref::database-internals/store-formats.adoc[Store formats].
176+
177+
If the store is seeded with `seedURI` or `existingDataSeedServer`, or if the command is used to mount pre-existing store files already present on the disk, they will retain their current store format without any modifications.
178+
179+
| `existingData` label:deprecated[Deprecated]
180+
| `use`
181+
|
182+
Included for backward compatibility only, has no effect and will be removed in a future version
183+
184+
|===
185+
======
186+
=====
132187

133188
=== Examples
134189

@@ -164,6 +219,10 @@ SHOW DATABASES YIELD name
164219

165220
==== Create a database with xref:database-administration/standard-databases/wait-options.adoc[`WAIT`]
166221

222+
[.tabbed-example]
223+
=====
224+
[.include-with-cypher5]
225+
======
167226
Sub-clause `WAIT` allows you to specify a time limit in which the command must complete and return.
168227

169228
[source, cypher]
@@ -183,7 +242,34 @@ CREATE DATABASE slow WAIT 5 SECONDS
183242

184243
The `success` column provides an aggregate status of whether or not the command is considered successful.
185244
Thus, every row has the same value, determined on a successful completion without a timeout.
245+
======
246+
[.include-with-cypher25]
247+
======
248+
Sub-clause `WAIT` allows you to specify a time limit in which the command must complete and return.
249+
250+
[source, cypher]
251+
----
252+
CREATE DATABASE slow WAIT 5 SECONDS
253+
----
254+
255+
.Result
256+
[role="queryresult"]
257+
----
258+
info: Server `ServerId{b55c6551}` at address `server1:7687` has caught up.
259+
03N85 (Neo.ClientNotification.Cluster.ServerCaughtUp)
260+
261+
info: Server `ServerId{a9e7e8f1}` at address `server2:7687` has caught up.
262+
03N85 (Neo.ClientNotification.Cluster.ServerCaughtUp)
263+
264+
info: Server `ServerId{0f7cb48e}` at address `server3:7687` has caught up.
265+
03N85 (Neo.ClientNotification.Cluster.ServerCaughtUp)
266+
----
186267

268+
The command will return a notification for each server in the cluster to indicate the status of that command
269+
on that server. In this case all three cluster members have returned `Neo.ClientNotification.Cluster.ServerCaughtUp`
270+
which indicates that the server has applied the command successfully and is up to date.
271+
======
272+
=====
187273

188274
==== Create databases with `IF NOT EXISTS` or `OR REPLACE`
189275

0 commit comments

Comments
 (0)