pg_dispatch
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_dispatch | 0.1.5 | TIME | PostgreSQL | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 1100 | pg_dispatch | No | No | No | Yes | No | No | - |
| Related | pgcrypto pg_cron pg_cron pg_task pg_later pg_background |
|---|
Pure SQL extension; runtime also needs pgcrypto from contrib in addition to pg_cron.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.5 | 1817161514 | pg_dispatch | pgcrypto, pg_cron |
| RPM | PIGSTY | 0.1.5 | 1817161514 | pg_dispatch_$v | - |
| DEB | PIGSTY | 0.1.5 | 1817161514 | postgresql-$v-pg-dispatch | postgresql-$v-cron |
Build
You can build the RPM / DEB packages for pg_dispatch using pig build:
pig build pkg pg_dispatch # build RPM / DEB packages
Install
You can install pg_dispatch directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install pg_dispatch; # Install for current active PG version
pig ext install -y pg_dispatch -v 18 # PG 18
pig ext install -y pg_dispatch -v 17 # PG 17
pig ext install -y pg_dispatch -v 16 # PG 16
pig ext install -y pg_dispatch -v 15 # PG 15
pig ext install -y pg_dispatch -v 14 # PG 14
dnf install -y pg_dispatch_18 # PG 18
dnf install -y pg_dispatch_17 # PG 17
dnf install -y pg_dispatch_16 # PG 16
dnf install -y pg_dispatch_15 # PG 15
dnf install -y pg_dispatch_14 # PG 14
apt install -y postgresql-18-pg-dispatch # PG 18
apt install -y postgresql-17-pg-dispatch # PG 17
apt install -y postgresql-16-pg-dispatch # PG 16
apt install -y postgresql-15-pg-dispatch # PG 15
apt install -y postgresql-14-pg-dispatch # PG 14
Create Extension:
CREATE EXTENSION pg_dispatch CASCADE; -- requires: pgcrypto, pg_cron
Usage
Source: README, database.dev page
pg_dispatch is a TLE-compatible async SQL dispatcher built on pg_cron. It is intended for deferring side effects out of the caller’s main transaction in sandboxed environments such as RDS or Supabase.
Requirements and install
- PostgreSQL 13+
pg_cron1.5.0+pgcrypto
SELECT dbdev.install(Snehil_Shah@pg_dispatch);
CREATE EXTENSION "Snehil_Shah@pg_dispatch";
The extension installs into the pgdispatch schema.
Main functions
SELECT pgdispatch.fire('SELECT pg_sleep(40);');
SELECT pgdispatch.snooze('SELECT pg_sleep(20);', '20 seconds');
pgdispatch.fire(command text): enqueue SQL for immediate async execution.pgdispatch.snooze(command text, delay interval): enqueue SQL for delayed async execution.
Typical use
The official README positions pg_dispatch for PL/pgSQL or trigger-based workflows where a foreground RPC should commit quickly while notifications, analytics updates, or other expensive SQL run later in a separate transaction.
Caveats
- The runtime dependency on
pgcryptois in addition topg_cron. - The
delayargument truncates to seconds precision. - The project documents TLE/database.dev installation first; manual PGXN installation is also linked from the README.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.