PostgreSQL on Render
Migrating from Heroku? We’re previewing an upcoming tool for low-downtime PostgreSQL migration and are looking for organizations with a large (50+ GB) Heroku Postgres database to migrate. We’ll work with selected organizations to help ensure a successful, speedy migration.
Render offers fully managed PostgreSQL for encrypted, scalable storage and retrieval of relational data.
These Render quickstarts include steps for provisioning a PostgreSQL database:
Go to dashboard.render.com/new/database, or select New > PostgreSQL from the Render Dashboard.
This form appears:
Provide a helpful Name for your database.
- You can change this value at any time.
Optionally fill in the Database and/or User fields if you want to set your PostgreSQL
- Render generates values for either of these that you don’t specify.
- You can’t change these values after creating your database.
Choose a Region to run your database in.
- Choose the same region as your services that will connect to the database. This minimizes latency and enables communication over your private network.
Optionally change the PostgreSQL Version if you want to use an older version.
- Major versions 12 through 16 are available for all new instances.
- Version 11 is also available if the owning individual or team account has at least one existing database on version 11.
Scroll down to select an instance type for your database:
Note that you can upgrade an existing database to a larger instance type at any time, but you can’t downgrade to a smaller instance.
Click Create Database.
Every Render PostgreSQL database has two different URLs for incoming connections:
- An internal URL for connections from your other Render services hosted in the same region
- An external URL for connections from everything else
Use the internal URL wherever possible. It minimizes query latency by enabling communication over your private network.
Both URLs are available from the Connect menu in the upper-right corner of your database’s page in the Render Dashboard:
How you connect to your database depends on your code: some frameworks expect a single connection string or URL in an environment variable, while others need multiple connection parameters in a configuration file. See Quickstarts for examples.
At a minimum, your app needs to know your database’s hostname, port, username, password, and database name (such as
mydb in the official PostgreSQL tutorial).
Render uses the default PostgreSQL port
5432 to connect. You can usually leave this port unspecified.
To use the internal URL, your connecting service and your database must belong to the same account and region.
Wherever possible, connect to your database using its internal URL. Internal connection details are available on your database’s Info page in the Render Dashboard:
In addition to viewing the individual details, you can view the combined internal URL (of the format
postgres://USER:PASSWORD@INTERNAL_HOST:PORT/DATABASE). Use whichever format your framework expects for database credentials.
External URL connections are slower because they traverse the public internet. Always use the internal URL when connecting from a Render service running in the same region.
Tools and systems outside of Render can connect to your database via its external URL, available in the Render Dashboard:
Most database clients understand the external URL, which has the format
You can also run the provided PSQL Command directly in your terminal to start a
If you encounter an SSL error, confirm that your PostgreSQL client supports TLS version 1.2 or higher, and that it supports any of the following cipher suites:
Click to show
By default, your PostgreSQL instance is accessible from any IP address (provided the connection includes valid credentials). You can modify this default behavior by restricting access to a set of IPs, or even disabling external access entirely.
In the Render Dashboard, go to your database’s Info page and scroll down to the Access Control section:
You can specify IP address blocks concisely using CIDR notation.
Your database’s maximum number of simultaneous connections depends on its instance type’s total memory (RAM):
|Between 6GB and 10GB
All instances created before 11 August 2021 support a maximum of 97 connections, regardless of allocated memory. To schedule a configuration update to migrate to the connection limits listed above, please email email@example.com.
The simplest configuration used by most applications is to have a single database per PostgreSQL instance. However, Render also supports creating multiple databases in a single instance. You can create a new database inside your instance by connecting to it with
psql and and using the
CREATE DATABASE <name> command. You can connect to the newly created database the same way,
postgres://USER:NAME@HOST:PORT/name. Make sure to use version
psql >= 14.2 when connecting from outside Render.
Note: This feature is available by default on PostgreSQL instances created after October 30th 2022. If you’d like to create multiple databases in an instance created before October 30, 2022, please contact support with your database details so we can enable the feature on your instance.
We offer PostgreSQL instance types ranging from 1 GB to 256 GB of storage per instance. The database storage limit applies to all storage the PostgreSQL database needs, including caches, indices, etc. Backup storage does not count against your instance type’s storage limit.
We can always work with you to provide a custom instance type; just email us at firstname.lastname@example.org.
Render encrypts PostgreSQL databases at rest using AES-256 data encryption. This encryption applies to the primary and replica instances and all automated backups. Public access to your PostgreSQL databases is encrypted in transit using Render managed TLS certificates.
You can view database metrics any time in the Render Dashboard. We currently support the following metrics:
|The amount of memory used
|The amount of CPU used
|The amount of disk space used
|The number of active connections
The Datadog integration provides additional metrics related to your PostgreSQL instance’s host and disk. You can also use the Datadog UI to create dashboards and alerts for your database.
For details, see the Datadog integration docs.
You can update your instance type to a larger instance with more RAM, CPU, and Storage.
Your database will be unavailable during the upgrade.
If you need an instance with more RAM, CPU, or storage than any offered instance type, please contact support for assistance creating a custom instance type.
It is not currently possible to downgrade an existing database’s instance type. When creating your database, make sure to pick the instance type that works best for you.
If you want to move to a smaller instance type, create a new instance and restore a backup of your existing instance to it.
Render does not retain backups or snapshots of a deleted database instance! Make sure to download any necessary backups before deleting your database.
You can delete a database instance from the Render Dashboard. Scroll down to the bottom of your database’s Info page and click Delete Database.
See articles on the following: