> ## Documentation Index
> Fetch the complete documentation index at: https://docs.risingwave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CREATE DATABASE

> Use the `CREATE DATABASE` command to create a new database.

## Syntax

```sql theme={null}
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 clause | Description |
| :- | :- |
| *database\_name* | The name of the database to be created. |
| **IF NOT EXISTS** clause | Creates a database if the database name has not already been used. Otherwise throws an error. |
| **owner \[=] user\_name** clause | Specifies which user owns the database to be created. |
| **resource\_group \[=] resource\_group\_name** clause | Assigns the database to a specific resource group. If not set, the database belongs to the default resource group. |
| **barrier\_interval\_ms \[=] integer** clause | Sets how frequently the system injects barriers per-database. If not specified, uses the global settings defined in `SystemParams`. |
| **checkpoint\_frequency \[=] integer** clause | Sets how many barriers should pass before triggering a checkpoint per-database. If not specified, uses the global settings defined in `SystemParams`. |

> [!NOTE]
>
> Added in v2.5.0: `barrier_interval_ms` and `checkpoint_frequency`.

> [!NOTE]
>
> These parameters control barrier/checkpoint timing. By default, RisingWave generates one barrier every **1 second** (`barrier_interval_ms = 1000`) and creates one checkpoint per barrier (`checkpoint_frequency = 1`). Most users should keep the defaults. See [Data persistence](https://docs.risingwave.com/reference/data-persistence.md#what-are-barriers-and-checkpoints).

> [!TIP]
>
> **PREMIUM FEATURE**
>
> This is a premium feature. For a comprehensive overview of all premium features and their usage, please see [RisingWave premium features](https://docs.risingwave.com/get-started/premium-features.md).

> [!NOTE]
>
> 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](https://docs.risingwave.com/sql/identifiers.md).

## Example

Set resource group:

```sql theme={null}
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:

```sql Create database theme={null}
CREATE DATABASE IF NOT EXISTS travel
    WITH 
        OWNER = travel_admin
        BARRIER_INTERVAL_MS = 1500
        CHECKPOINT_FREQUENCY = 5;
```

## Related topic

To change the owner, barrier interval, or checkpoint frequency of an existing database, see the [ALTER DATABASE](https://docs.risingwave.com/sql/commands/sql-alter-database.md) command.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.