Skip to main content
PostgreSQL is an open-source relational database management system (RDBMS) that’s popular for its reliability, feature set, and community support. This guide walks you through running PostgreSQL on an Archil disk. PostgreSQL doesn’t need to know anything about Archil or S3 — it just reads and writes files to its data directory as usual. By pointing that data directory at an Archil mount, you get:
  • Elastic storage: no need to provision or resize disks as your database grows
  • S3 durability: all data is automatically synchronized to S3 in the background
  • Pay for what you use: you’re only billed for active data, not provisioned capacity
  • Portability: unmount from one server and mount on another to move your database

Create an Archil disk

First, follow the Archil Getting Started Guide to create an Archil disk.

Install PostgreSQL

The exact instructions for installing PostgreSQL will vary depending on your operating system. For example, on Amazon Linux 2023, you can install PostgreSQL with the following command:
Next, mount your Archil disk to an easy to access directory.
Then, edit the PostgreSQL service files to point to the Archil disk. On Amazon Linux 2023, use the systemctl command
Add the following lines to the file:
Then, initialize the PostgreSQL database, and start the service.
You can validate that postgres is successfully running on Archil by executing the following command:
This should output the PGDATA directory you previously set up, /mnt/archil/pgdata.

Connect and use your database

Now that PostgreSQL is running on Archil, you can connect to it and use it normally with the psql command or from an application. PostgreSQL is unaware of Archil — it reads and writes files to its data directory like it normally would. Archil handles caching those files on fast SSD storage and asynchronously synchronizing them to S3. When your database is idle, you’re not charged for Archil’s high-speed cache — you only pay for the data stored in S3.

(Optional) Run pgbench benchmarks to validate performance

First, install the pgbench tool.
Then, initialize the benchmark database:
Finally, you can run a basic benchmark to validate performance.
This will run a benchmark for 30 seconds with 10 connections and 2 threads.