Databases
Stateless services are simple and scalable, but most complex services eventually end up needing persistent state. Fortunately, you can store state in a fully managed PostgreSQL database on Render.
PostgreSQL is a powerful, open-source, object-relational database management system used globally by some of the world’s best technology companies. Render’s managed PostgreSQL offering makes it easy to use PostgreSQL in a secure, reliable, and completely hands-off way. Your database comes with encryption at rest, automated backups, and expandable SSD storage.
Getting Started
We have some examples backed by PostgreSQL to get you started:
Creating a Database
You can create a PostgreSQL database on Render in under a minute. Like web services, you can give your database a memorable name (which you can change at any time).
Connecting to Your Database
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 Getting Started for examples.
At a minimum, your app will need to know your database’s hostname, port, username, password, and database name (e.g. mydb
in the official tutorial).
The hostname will differ depending on where you’re connecting from. For services deployed on Render, you should always use the internal connection parameters shown below. This minimizes network latency and maximizes app performance.
You can have up to 97 simultaneous connections to your database.
Connecting From Apps on Render
Using internal connection values is the recommended way for your apps to connect to your Render database. The hostname, username, database, and password are displayed on the database page:
An internal connection string that looks like postgres://USER:PASSWORD@HOST:PORT/DATABASE
is also available if needed. Many database frameworks allow (or require) a connection string instead of individual connection parameters.
Connecting From Outside Render
You might want to run ad-hoc queries or migrations against your database from machines outside Render. In these cases you can connect to your database using the external connection string on the database page.
Most database clients understand the external connection string, which (like the internal connection string) looks like postgres://USER:NAME@HOST:PORT/DATABASE
. We also provide the PSQL command to connect to your database which can be copied and run in the terminal as is.
Access Control
New databases are accessible to any IP address with the right credentials. You can remove the default rule and add your own IP addresses or even disable all external access by removing all the rules in the data access section of your database page.
The rules apply to connections from outside Render’s network. Services within the same team or account can always use the internal connection string to access their databases.
Backups
No database is completely safe from data loss. This is why we take complete database backups every day and retain all backups for at least 7 days.
We take two kinds of snapshots: a SQL-based backup and a filesystem backup. SQL backups are enough for most purposes and can be restored using psql. You can find and download all backups on your database page in the dashboard.
We’re also happy to help with restores and disaster recovery. Just contact us on Render Community or email us at support@render.com.
Disk Space
Every database starts off with 1 GB of storage. We can increase the storage for your database if needed — just let us know in our user community or by email at support@render.com.
Database Versions & Upgrades
The major version for your database is fixed when it is created. We don’t do major database version upgrades without your permission, because it can be unsafe to do so.
All new databases are created with PostgreSQL version 11.
We will periodically upgrade the minor version of your databases to apply the latest security fixes. Minor version upgrades incur little to no downtime and are done during low-traffic time windows.
Deleting Databases
If you decide to delete a database, we do not retain backups or snapshots of your data. Make sure to download a backup before deletion.
PostgreSQL Extensions
The following extensions are enabled on all PostgreSQL databases by default.
postgis
) create additional schemas (like topology
) and tables (like spatial_ref_sys
).
- bloom
- btree_gin
- btree_gist
- citext
- cube
- dblink
- dict_int
- dict_xsyn
- earthdistance
- fuzzystrmatch
- hstore
- intagg
- intarray
- isn
- lo
- ltree
- pg_buffercache
- pg_prewarm
- pg_stat_statements
- pg_trgm
- pgcrypto
- pgrowlocks
- pgstattuple
- postgis
- postgis_tiger_geocoder
- postgis_topology
- tablefunc
- unaccent
- uuid-ossp
If you don’t need an extension and would like to drop it, feel free to email us and we’d be happy to delete it for you. We’re working on enabling users to add and drop extensions on their own.