Connecting to PostgreSQL

Aptible Deploy 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 Deploy 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.


Aptible Deploy 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 in the repository we use to manage those images: aptible/docker-postgresql.

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.


Master-standby replication is available for PostgreSQL. Replicas can be created using the aptible db:replicate command.

Data Integrity and Durability

On Aptible Deploy, PostgreSQL is configured with default settings for write-ahead logging. Committed transactions are therefore guaranteed to be written to disk.


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 Deploy 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 Deploy PostgreSQL Databases support connections via the following protocols:

  • For PostgreSQL versions 9.3, 9.4, 9.5, 9.6, 10, and 11: TLSv1.0, TLSv1.1, TLSv1.2

Did this page help you?