# PostgreSQL with pg_cron

PostgreSQL with pg_cron is an OSS Apps Docker image of PostgreSQL, the open-source object-relational database, preconfigured with the pg_cron extension. It is open source and self-hosted, installable on Docker Hub and Unraid.

Canonical page: https://ourlocalhost.com/app/1488/postgresql-with-pg-cron

## Description

PostgreSQL with pg_cron is an OSS Apps Docker image of PostgreSQL, the open-source object-relational database, preconfigured with the pg_cron extension. It lets you schedule recurring SQL jobs such as backups and maintenance directly inside the database, removing the need for an external cron setup.

## Platform availability

Available on 1 of 9 platforms: Unraid.

## Health score

46/100 (Fair), based on 2 of 4 factors.
- Easy to install: 35 (1 install platform, install notes, Docker image)
- Light to run: 60 (2 GB minimum RAM, runs on ARM)

## Links

- Docker Hub: https://hub.docker.com/r/ossapps/postgres
- Unraid: https://ca.unraid.net/apps/postgresql-pg-corn-0kwt9aj0ih99xb?q=PostgreSQL_pg_corn

## Common questions

### Does pg_cron need special handling when using Postgres in Docker?

pg_cron is not included in the default Postgres Docker image. You usually need to extend the image or adjust docker-compose to install and use it.

### What data-directory permission issue can prevent PostgreSQL from starting?

Create a dedicated postgres account and a data folder owned by that account before initializing PostgreSQL. If the folder is owned by the wrong user, PostgreSQL can fail to start or write data because of permission errors.

### Can I start PostgreSQL as root in a self-hosted setup?

Use the postgres account when running pg_ctl to start the server. Starting as root can create root-owned data files and is less secure, which can cause later permission problems.

### What ongoing operations am I responsible for when self-hosting PostgreSQL?

You become fully accountable for backups, downtime, and patching. You should verify that you can actually restore from your backups.

## Alternatives

- Apache Cassandra
- CockroachDB: CockroachDB is a distributed SQL database for developers and operators of transactional applications that need horizontal scaling and resil…
- CouchDB: Apache CouchDB is a document database that stores JSON data and speaks HTTP, with built-in replication, change tracking, and flexible views…
- FerretDB: FerretDB is an open-source MongoDB compatibility proxy for self-hosted stacks.
- Firebird: Firebird is a relational database offering many ANSI SQL-92 features that runs on Linux, Windows, and a variety of Unix platforms.
- Microsoft SQL Server: SQL Server delivers on Microsoft’s Data Platform vision by helping your organization manage your data by enabling you to store data from st…
- MongoDB: MongoDB is a cross-platform, open-source document-oriented NoSQL database that stores data in flexible, JSON-like BSON documents instead of…
- MySQL Community Edition: Free GPL database platform supporting SQL and NoSQL applications with InnoDB storage, replication, clustering, connectors, and cross-platfo…
- SQLite: SQLite is a lightweight, embedded relational database engine that stores an entire database in a single file on your device.
- SurrealDB: SurrealDB is a modern "all-in-one" database that stores and organises your app's information.
- mariadb: MariaDB is a fast, open-source relational database server forked from MySQL by its original developers.
- rethinkdb: RethinkDB is an open-source, distributed NoSQL database built for realtime web applications.

---
Source: Our Local Host (https://ourlocalhost.com/app/1488/postgresql-with-pg-cron), the self-hosted and open-source app directory.
