PostgreSQL
Learn about running secure, Managed PostgreSQL Databases on Aptible
Available Versions
The following versions of PostgreSQL are currently available:
Version | Status | End-Of-Life Date | Deprecation Date |
---|---|---|---|
9.6 | Deprecating (EOL) | November 2021 | October 31, 2024 |
10 | Deprecating (EOL) | November 2022 | October 31, 2024 |
11 | Deprecating (EOL) | November 2023 | October 31, 2024 |
12 | Available | November 2024 | February 2025 |
13 | Available | November 2025 | February 2026 |
14 | Available | November 2026 | February 2027 |
15 | Available | November 2027 | February 2028 |
16 | Available | November 2028 | February 2029 |
DEPRECATED
on the deprecation date listed above. While existing databases will not be affected, we recommend end-of-life databases to be upgraded. The latest version offered on Aptible will always be available for provisioning, regardless of end-of-life date. Connecting to PostgreSQL
Aptible PostgreSQL Databases require authentication and SSL to connect.
Connecting with SSL
Most PostgreSQL clients will attempt connection over SSL by default. If yours doesn’t, try appending ?ssl=true
to your connection URL, or review your client’s documentation.
Most PostgreSQL clients will not attempt verification of the server certificate by default, please consult your client’s documentation to enable verify-full
, or your client’s equivalent option. The relevant documentation for libpq is here.
By default, PostgreSQL Databases on Aptible use a server certificate signed by Aptible for SSL / TLS termination. Databases that have been running since prior to Jan 15th, 2021 will only have a self-signed certificate. See Database Encryption in Transit for more details.
Extensions
Aptible supports two families of images for Postgres: default and contrib.
- The default images have a minimal number of extensions installed, but do include PostGIS.
- The alternative contrib images have a larger number of useful extensions installed. The list of available extensions is visible below.
- In PostgreSQL versions 14 and newer, there is no sperate contrib image: the listed extension are avaiable in the default image.
Extension | Avaiable in versions |
---|---|
plpythonu | 9.5 - 11 |
plpython2u | 9.5 - 11 |
plpython3u | 9.5 - 12 |
plperl | 9.5 - 12 |
plperlu | 9.5 - 12 |
mysql_fdw | 9.5 - 11 |
PLV8 | 9.5 - 10 |
multicorn | 9.5 - 10 |
wal2json | 9.5 - 16 |
pg-safeupdate | 9.5 - 11 |
pg_repack | 9.5 - 16 |
pgagent | 9.5 - 13 |
pgaudit | 9.5 - 13 |
pgcron | 10 |
pgvector | 15-16 |
If you require a particular PostgreSQL plugin, contact Aptible Support to identify whether a contrib image is a good fit. Alternatively, you can launch a new PostgreSQL database using a contrib image with the aptible db:create
command.
Replication
Primary-standby replication is available for PostgreSQL. Replicas can be created using the aptible db:replicate
command.
Failover
PostgreSQL replicas can be manually promoted to stop following the primary and start accepting writes. To do so, run one of the following commands depending on your Database’s version:
PostgreSQL 12 and higher
SELECT pg_promote();
PostgreSQL 11 and lower
COPY (SELECT 'fast') TO '/var/db/pgsql.trigger';
After the replica has been promoted, you should update your Apps to use the promoted replica as the primary Database. Once you start using the replica, you should not go back to using the original primary Database. Instead, continue using the promoted replica and create a new replica off of it.
Aptible maintains a link between replicas and their source Database to ensure the source Database cannot be deleted before the replica. To deprovision the source Database after you’ve failed over to a promoted replica, users with the appropriate roles and permissions can unlink the replica from the source Database. Navigate to the replica’s settings page to complete the unlinking process. See the Deprovisioning a Database documentation for considerations when deprovisioning a Database.
Data Integrity and Durability
On Aptible, PostgreSQL is configured with default settings for write-ahead logging. Committed transactions are therefore guaranteed to be written to disk.
Configuration
A PostgreSQL database’s pg_settings
can be changed with ALTER SYSTEM
. Changes made this way are written to disk and will persist across database restarts.
PostgreSQL databases on Aptible autotune the size of their caches and working memory based on the size of their container in order to improve performance. See the image’s public git repo for details.
The following settings are autotuned:
shared_buffers
effective_cache_size
work_mem
maintenance_work_mem
checkpoint_completion_target
default_statistics_target
Modifying these settings is not recommended as the setting will no longer scale with the size of the database’s container.
Connection Security
Aptible PostgreSQL Databases support connections via the following protocols:
- For PostgreSQL versions 9.6, 10, 11, and 12:
TLSv1.0
,TLSv1.1
,TLSv1.2
- For PostgreSQL versions 13 and 14:
TLSv1.2
- For PostgreSQL versions 15 and 16:
TLSv1.2
,TLSv1.3