pg_dispatch
pg_dispatch : Asynchronous SQL dispatcher built on pg_cron
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 1100 | pg_dispatch
|
pg_dispatch
|
0.1.5 |
TIME
|
PostgreSQL
|
SQL
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
----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
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
0.1.5 |
18
17
16
15
14
|
pg_dispatch |
pgcrypto, 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-dispatch |
postgresql-$v-cron |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
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
|
Source
pig build pkg pg_dispatch; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall 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 14Create this extension with:
CREATE EXTENSION pg_dispatch CASCADE; -- requires pgcrypto, pg_cronUsage
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.