SingleStore Managed Service

CREATE DATABASE

Creates a database.

Syntax
CREATE DATABASE [IF NOT EXISTS] <database_name> [<sync_options>] [PARTITIONS n]
    [<create_specification>]

<sync_options>:
    WITH SYNC REPLICATION

<create_specification>:
    [DEFAULT] CHARACTER SET [=] charset_name

-- "schema" is an alias for "database"
CREATE SCHEMA [IF NOT EXISTS]...
Remarks
  • database_name is the name to assign to this new SingleStore database. Do not use the _XX suffix (such as test_database_01) while naming a SingleStore DB database as it may cause a mismatch with the database partition ordinals (sharded databases on each leaf node).

  • High availability, redundancy-2 replication will always be done synchronously. The WITH SYNC REPLICATION clause can be optionally specified, but specifying it has no effect on replication behavior.

  • PARTITIONS n allows you to set the total number of partitions that the data will be split into. By default this is controlled by the default_partitions_per_leaf variable. Note that n refers to the total number of partitions across all leaves.

  • The CREATE DATABASE ... DEFAULT CHARSET= syntax is accepted by SingleStore for compatibility with MySQL, but it has no effect. The database and its schema objects use the server character set and collation.Default Character Set and Collation

Examples

The following example creates a local database that uses all of the default options.

CREATE DATABASE IF NOT EXISTS test;