Database management in Managed Service for PostgreSQL
You can add and remove databases, as well as view information about them.
Warning
You can't manage databases using SQL commands.
Getting a list of cluster databases
- Go to the folder page
and select Managed Service for PostgreSQL. - Click on the name of the cluster you need and select the Databases tab.
If you don't have the Nebius AI command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To get a list of databases in a cluster, run the command:
ncp managed-postgresql database list --cluster-name=<cluster name>
The cluster name can be requested with a list of clusters in the folder.
Creating a database
Note
You can create a maximum of 1000 databases in each cluster.
-
Go to the folder page
and select Managed Service for PostgreSQL. -
Click the cluster name.
-
If the new database does not have an owner among its current users, add such a user.
-
Select the Databases tab.
-
Click
-
Specify the database settings.
-
Name.
A database name may contain Latin letters, numbers, underscores, and hyphens. The maximum name length is 63 characters. The names
postgres
,template0
andtemplate1
are reserved for Managed Service for PostgreSQL. You cannot create databases with these names. -
Owner.
-
(Optional) Template: The name of one of the existing databases from which the data schema needs to be copied. All connections to the template database will be closed while the new database is being created.
For more information, see the PostgreSQL documentation
. -
Collation and character set locales.
PostgreSQL uses locales to support various language standards. The locale you choose affects:
- Sort order in the queries that use the
ORDER BY
operator or standard text data matching operators. - The functions
upper
,lower
,initcap
, and theto_char
family of functions. - Pattern matching operators (
LIKE
,ILIKE
,SIMILAR TO
, regular expressions). - Support of indexes with the
LIKE
operator.
By default, the
C
locale is used. if you use theC
encoding for text data containing non-Latin characters, errors might occur in the data sort order and data display in the case of pattern search. If this locale is not suitable for valid processing of tables in your database, select another encoding from the list. However, please keep in mind that a non-standard locale might decrease the database query processing rate.For more information about locale settings, see the PostgreSQL documentation
.You cannot change locale settings after you create a database. However, you can set the sorting locale for columns when creating and modifying individual tables. Learn more in the PostgreSQL documentation
. - Sort order in the queries that use the
-
-
Click Add.
If you don't have the Nebius AI command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To create a database in a cluster:
-
View a description of the CLI create database command:
ncp managed-postgresql database create --help
-
Request a list of cluster users to select the owner of the new database:
ncp managed-postgresql user list --cluster-name=<cluster name>
If the required user is not in the list, create it.
-
Run the create database command. If necessary, specify the required collation and character set locales (default settings are
LC_COLLATE=C
andLC_CTYPE=C
) and the template:ncp managed-postgresql database create <database name> \ --cluster-name=<cluster name> \ --owner=<owner username> \ --lc-collate=<collation locale> \ --lc-type=<character set locale> \ --template-db=<name of database used as template>
A database name may contain Latin letters, numbers, underscores, and hyphens. The maximum name length is 63 characters. The names
postgres
,template0
andtemplate1
are reserved for Managed Service for PostgreSQL. You cannot create databases with these names.The cluster name can be requested with a list of clusters in the folder.
Managed Service for PostgreSQL runs the create database operation.
Deleting a database
- Go to the folder page
and select Managed Service for PostgreSQL. - Click on the name of the cluster you need and select the Databases tab.
- Click the
If you don't have the Nebius AI command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To delete a database, run the command:
ncp managed-postgresql database delete <database name> \
--cluster-name <cluster name>
The cluster name can be requested with a list of clusters in the folder.
Warning
Before creating a new database with the same name, wait for the delete operation to complete, otherwise the database being deleted will be restored. Operation status can be obtained with a list of cluster operations.