This topic describes how to create a database in the Hologres console or from the
PostgreSQL client.
Background information
After you purchase a Hologres instance, a database named postgres is automatically created. This database is allocated with a few resources and used
only for management purposes. Therefore, we recommend that you create another database
to process business data.
Only a superuser or a user granted the database creation permissions can create a
database.
Create a database in the Hologres console
- Log on to the Hologres console. In the left-side navigation pane, click Instances.
- On the Hologres Instances page, find the instance for which you want to create a database and click the instance
name.
You can also find the instance for which you want to create a database and click Manage in the Actions column to go to the instance details page.
- In the left-side pane of the instance details page, click Databases.
- On the Database Authorization page, click Create Database in the upper-right corner.
- In the Create Database dialog box, select the name of the instance for which you want to create the database
from the Instance Name drop-down list, enter a database name in the Database Name field, and then specify a permission model based on your business needs by setting
the SPM parameter. We recommend that you select SPM.
Permission model |
Description |
Simple permission model (SPM) |
If the SPM is used, permissions are granted at the database level. The following user
groups are provided: admin, developer, writer, and viewer. You need to use only a
few functions to manage the permissions on the objects in a database in a convenient
and secure way. For more information, see Overview.
|
Schema-level permission model (SLPM) |
If the SLPM is used, permissions are granted at the schema level. The following user
groups are provided: <db>.admin, <db>.<schema>.developer, <db>.<schema>.writer, and
<db>.<schema>.viewer. Compared with the SPM, the SLPM manages permissions in a more
fine-grained manner. For more information, see Overview.
|
Standard PostgreSQL authorization model |
Hologres allows you to use the standard PostgreSQL authorization model. For more information,
see Standard PostgreSQL authorization model.
|

- Click OK.
You can view the created database on the Database Authorization page.
Create a database from the PostgreSQL client
- Connect to the Hologres instance for which you want to create a database from the
PostgreSQL client. For more information, see Connect to a Hologres instance from the PostgreSQL client.
- Execute the CREATE Database statement to create a database. The following code provides
the syntax and a sample statement:
CREATE Database NewDatabaseName;
CREATE Database test; // Create a database named test.
- Run the
\l
command to view the databases in the instance.
- Run the
\c NewDatabaseName
command to connect to the newly created database. When you run this command, replace
NewDatabaseName with the name of the created database.
What to do next
Execute standard PostgreSQL statements to analyze data from the PostgreSQL client.
For example, you can execute SQL statements to import MaxCompute data to Hologres.
For more information, see Import data from MaxCompute to Hologres by executing SQL statements.
You can also use HoloWeb to analyze data. For more information, see HoloWeb quick start.