Syntax

CREATE DATABASE [ IF NOT EXISTS ] database_name
    [ WITH ] [ owner [=] user_name ]
    [ resource_group [=] resource_group_name ]
    [ barrier_interval_ms [=] integer ]
    [ checkpoint_frequency [=] integer ];

Parameters

Parameter or clauseDescription
database_nameThe name of the database to be created.
IF NOT EXISTS clauseCreates a database if the database name has not already been used. Otherwise throws an error.
owner [=] user_name clauseSpecifies which user owns the database to be created.
resource_group [=] resource_group_name clauseAssigns the database to a specific resource group. If not set, the database belongs to the default resource group.
barrier_interval_ms [=] integer clauseSets how frequently the system injects barriers per-database. If not specified, uses the global settings defined in SystemParams.
checkpoint_frequency [=] integer clauseSets how many barriers should pass before triggering a checkpoint per-database. If not specified, uses the global settings defined in SystemParams.

Added in v2.5.0: barrier_interval_ms and checkpoint_frequency.

PREMIUM EDITION FEATURE

Resource groups is a Premium Edition feature. All Premium Edition features are available out of the box without additional cost on RisingWave Cloud. For self-hosted deployments, users need to purchase a license key to access this feature. To purchase a license key, please contact sales team at sales@risingwave-labs.com.

For a full list of Premium Edition features, see RisingWave Premium Edition.

Names and unquoted identifiers are case-insensitive. Therefore, you must double-quote any of these fields for them to be case-sensitive. See also Identifiers.

Example

Set resource group:

CREATE DATABASE IF NOT EXISTS travel
    WITH OWNER = travel_admin
    RESOURCE_GROUP = high_priority;

Set a custom barrier interval and checkpoint frequency for a database:

Create database
CREATE DATABASE IF NOT EXISTS travel
    WITH 
        OWNER = travel_admin
        BARRIER_INTERVAL_MS = 1500
        CHECKPOINT_FREQUENCY = 5;

To change the owner, barrier interval, or checkpoint frequency of an existing database, see the ALTER DATABASE command.