Creates a database in a Hologres instance.
Syntax
CREATE DATABASE db_name
[ [ WITH ] [ OWNER [=] user_name ] ]
;Parameters
| Parameter | Description |
|---|---|
db_name | The name of the database to create. Can contain only letters, digits, and underscores (_). |
user_name | The account to set as the database Owner. If omitted, the account running the statement becomes the Owner and receives Superuser permission. The Owner can grant Superuser permission to other users and can delete the database. Deleting a database removes all objects it contains, including tables and data. |
Limitations
A single instance supports a maximum of 64 databases.
Usage notes
When a Hologres instance is activated, the system automatically creates a postgres database. This database has limited resources and is intended for management purposes only. Create a separate database for business workloads.
A superuser can create databases for other users and assign ownership, enabling those users to manage and configure their own databases independently.
Examples
Create a database with default ownership (the executing account becomes the Owner):
CREATE DATABASE testdb;