Skip to content
pg_dispatch

pg_dispatch

pg_dispatch : Asynchronous SQL dispatcher built on pg_cron

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
1100
pg_dispatch
pg_dispatch
0.1.5
TIME
PostgreSQL
SQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d--
No
No
No
Yes
no
no
Relationships
Requires
pgcrypto
pg_cron
See Also
pg_cron
pg_task
pg_later
pg_background

Pure SQL extension; runtime also needs pgcrypto from contrib in addition to pg_cron.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.1.5
18
17
16
15
14
pg_dispatchpgcrypto, pg_cron
RPM
PIGSTY
0.1.5
18
17
16
15
14
pg_dispatch_$v-
DEB
PIGSTY
0.1.5
18
17
16
15
14
postgresql-$v-pg-dispatchpostgresql-$v-cron
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el8.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el9.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el9.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el10.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el10.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
d12.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
d12.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
d13.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
d13.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u22.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u22.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u24.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u24.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u26.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u26.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PackageVersionOSORGSIZEFile URL
pg_dispatch_180.1.5el8.x86_64pigsty10.4 KiBpg_dispatch_18-0.1.5-1PIGSTY.el8.x86_64.rpm
pg_dispatch_180.1.5el8.aarch64pigsty10.3 KiBpg_dispatch_18-0.1.5-1PIGSTY.el8.aarch64.rpm
pg_dispatch_180.1.5el9.x86_64pigsty10.4 KiBpg_dispatch_18-0.1.5-1PIGSTY.el9.x86_64.rpm
pg_dispatch_180.1.5el9.aarch64pigsty10.3 KiBpg_dispatch_18-0.1.5-1PIGSTY.el9.aarch64.rpm
pg_dispatch_180.1.5el10.x86_64pigsty10.5 KiBpg_dispatch_18-0.1.5-1PIGSTY.el10.x86_64.rpm
pg_dispatch_180.1.5el10.aarch64pigsty10.5 KiBpg_dispatch_18-0.1.5-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-dispatch0.1.5d12.x86_64pigsty4.0 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-dispatch0.1.5d12.aarch64pigsty4.0 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-dispatch0.1.5d13.x86_64pigsty4.0 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-dispatch0.1.5d13.aarch64pigsty4.0 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-dispatch0.1.5u22.x86_64pigsty3.9 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-dispatch0.1.5u22.aarch64pigsty3.9 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-dispatch0.1.5u24.x86_64pigsty3.9 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~noble_amd64.deb
postgresql-18-pg-dispatch0.1.5u24.aarch64pigsty3.9 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~noble_arm64.deb
postgresql-18-pg-dispatch0.1.5u26.x86_64pigsty3.9 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~resolute_amd64.deb
postgresql-18-pg-dispatch0.1.5u26.aarch64pigsty3.9 KiBpostgresql-18-pg-dispatch_0.1.5-1PIGSTY~resolute_arm64.deb

Source

pig build pkg pg_dispatch;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_dispatch;		# install via package name, for the active PG version

pig install pg_dispatch -v 18;   # install for PG 18
pig install pg_dispatch -v 17;   # install for PG 17
pig install pg_dispatch -v 16;   # install for PG 16
pig install pg_dispatch -v 15;   # install for PG 15
pig install pg_dispatch -v 14;   # install for PG 14

Create this extension with:

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_cron 1.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 pgcrypto is in addition to pg_cron.
  • The delay argument truncates to seconds precision.
  • The project documents TLE/database.dev installation first; manual PGXN installation is also linked from the README.
Last updated on