> ## 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>

<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](/reference/data-persistence#what-are-barriers-and-checkpoints).
</Note>

<Tip>
  **PREMIUM FEATURE**

  This is a premium feature. For a comprehensive overview of all premium features and their usage, please see [RisingWave premium features](/get-started/premium-features).
</Tip>

<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](/sql/identifiers).
</Note>

## 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](/sql/commands/sql-alter-database) command.
