> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hydra.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Postgres

This guide shows how to migrate any Postgres database to Hydra. This migration requires the [pg\_dump](https://www.postgresql.org/docs/current/app-pgdump.html) and [psql](https://www.postgresql.org/docs/current/app-psql.html) CLI tools, which are installed automatically as part of the complete PostgreSQL installation package.

## Retrieve your Postgres database credentials

1. Log in to your provider to get the connection details for your Postgres database. You'll need the hostname, username, password, and port (if not 5432).

## Retrieve your Hydra connection string

1. If you're new to Hydra, create a project.

2. Select the project in the Hydra Platform and obtain your credential.

## Migrate the database

<AccordionGroup>
  <Accordion title="pg_dump" defaultOpen={false} icon="download" iconType="solid">
    You can use the [pg\_dump](https://www.postgresql.org/docs/current/app-pgdump.html) and [psql](https://www.postgresql.org/docs/current/app-psql.html) command line tools, which are included in a full PostgreSQL installation.

    Export your database to a file in console. Use `pg_dump` with your Postgres credentials to export your database to a file (e.g., `dump.sql`).

    ```bash theme={null}
    PGPASSWORD=$PASSWORD pg_dump --clean --if-exists --quote-all-identifiers -h $HOST -U $USER -d $DATABASE -p $PORT --no-owner --no-privileges > dump.sql
    ```
  </Accordion>

  <Accordion title="pg_restore" defaultOpen={false} icon="upload" iconType="solid">
    Import the database to your Hydra project. Use psql to import the Postgres database file to your Hydra project.

    ```bash theme={null}
    psql -d "$HYDRA_CONNECTION_STRING" -f dump.sql
    ```
  </Accordion>
</AccordionGroup>

### Additional options

* To only migrate a single database schema, add the `--schema=PATTERN` parameter to your `pg_dump` command.

* To exclude a schema: `--exclude-schema=PATTERN`.

* To only migrate a single table: `--table=PATTERN`.

* To exclude a table: `--exclude-table=PATTERN`.

Run `pg_dump --help` for a full list of options.

* If you're planning to migrate a database larger than 6 GB, we recommend upgrading to at least a Medium compute instance. This will ensure you have the necessary resources to handle the migration efficiently.

* You can increase the size of the disk on paid projects by navigating to the project Settings tab.

* If you're dealing with a database larger than 150 GB, we strongly advise you to

  [contact our support team](/platform/support)

  for assistance in provisioning the required resources and ensuring a smooth migration process.

## Enterprise

[Contact us](/platform/support) if you need more help migrating your project.
