---
title: Logical Databases
url: https://docs.vultr.com/products/storage/databases/postgresql/management/logical-databases
description: A guide for creating and managing logical databases within your Vultr Managed PostgreSQL database service.
publish_date: 2024-09-23T20:21:40.343288Z
last_updated: 2026-05-26T19:43:51.679476Z
---

# How to Manage Logical Databases for Vultr Managed Databases for PostgreSQL

Logical databases provide a structured collection of data creating a workspace for tables that in turn consist of columns and rows. A single database can store dozens or even hundreds of tables. For instance, in an e-commerce website, a database can store `products`, `categories`, `sales`, and `payments` tables.

Follow this guide to manage logical databases for Vultr Managed Databases for PostgreSQL using the Vultr Console, API, CLI, or Terraform.

=== "Vultr Console"

    1. Navigate to **Products** and select **Databases**.
    1. Click the target database instance.
    1. Navigate to **Users and Databases** and click **Add New Database**.
    1. Enter the **Database Name** (For example, `sample_company_db`) and click **Add Database**.
    1. Click **Destroy Database** to delete the database.

=== "Vultr API"

    1. List all the database instances by sending a `GET` request to the [**List Managed Databases** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/list-databases) and note the database ID. For example, `43b4c774-5dff-4ac0-a01f-78a23c2205b5`.

        ```console
        $ curl "https://api.vultr.com/v2/databases" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

    1. Send a `POST` request to the [**Create Logical Database** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/create-database-db) specifying the `name` of the logical database and the database ID.

        ```console
        $ curl "https://api.vultr.com/v2/databases/database_id/dbs" \
            -X POST \
            -H "Authorization: Bearer ${VULTR_API_KEY}" \
            -H "Content-Type: application/json" \
            --data '{
                "name" : "sample_company_db"
            }'
        ```

        Visit the [**Create Logical Database** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/create-database-db) to view additional attributes to add to your request.

    1. Send a `GET` request to the [**List Logical Databases** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/list-database-dbs) specifying the database ID to list the logical databases.

        ```console
        $ curl "https://api.vultr.com/v2/databases/database_id/dbs" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

    1. Send a `DELETE` request to the [**Delete Logical Database** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/delete-database-db) specifying the ID and the logical database `name` to delete the logical database.

        ```console
        $ curl "https://api.vultr.com/v2/databases/database_id/dbs/logical_database_name" \
            -X DELETE \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

=== "Vultr CLI"

    1. List all database instances and note the database ID. For instance, `d6ac2a3c-92ea-43ef-8185-71a23e58ad8c`.

        ```console
        $ vultr-cli database list --summarize
        ```

    1. Create a logical database by specifying the database name (For example, `sample_company_db`)  and the database ID.

        ```console
        $ vultr-cli database db create database_id --name database_name
        ```

    1. List all logical databases by specifying a database ID.

        ```console
        $ vultr-cli database db list database_id
        ```
    
        Run `vultr-cli database db --help` to view all options.

=== "Terraform"

    1. Ensure the [Vultr Terraform provider](https://registry.terraform.io/providers/vultr/vultr/latest/docs) is configured.

    1. Create a logical database with Terraform.

        ```terraform
        terraform {
            required_providers {
                vultr = {
                    source  = "vultr/vultr"
                    version = "~> 2.26"
                }
            }
        }

        provider "vultr" {}

        # Existing database assumed
        variable "database_id" { type = string }

        resource "vultr_database_db" "app" {
            database_id = var.database_id
            name        = "sample_company_db"
        }
        ```

    1. To delete the logical database, remove the resource block or run:

        ```console
        $ terraform destroy -target vultr_database_db.app
        ```
