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
|
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
Syntax:
CREATE EXTENSION "Snehil_Shah@pg_dispatch"; SELECT pgdispatch.fire('SELECT pg_sleep(40);'); SELECT pgdispatch.snooze('SELECT pg_sleep(20);', '20 seconds');Sources: README, database.dev page
pg_dispatch is an asynchronous SQL dispatcher for PostgreSQL. It is designed as a TLE-compatible alternative to pg_later, built on top of pg_cron, so it can be used in environments such as Supabase and AWS RDS.
Prerequisites
The upstream README lists:
- PostgreSQL 13 or newer
pg_cron1.5.0 or newerpgcrypto
Installation
The documented TLE installation path is:
SELECT dbdev.install(Snehil_Shah@pg_dispatch);
CREATE EXTENSION "Snehil_Shah@pg_dispatch";The README warns that the extension installs into the pgdispatch schema and can collide with an existing schema of the same name.
Functions
pgdispatch.fire(command text)
Dispatch an SQL command for asynchronous execution:
SELECT pgdispatch.fire('SELECT pg_sleep(40);');pgdispatch.snooze(command text, delay interval)
Dispatch a delayed SQL command:
SELECT pgdispatch.snooze('SELECT pg_sleep(20);', '20 seconds');The README notes that the delay is scheduled asynchronously and does not block the caller’s main transaction.
Use Cases
The project positions itself for database-native async side effects, especially in PL/pgSQL or trigger-based workflows. Its example use case is moving expensive notification or analytics work out of an AFTER INSERT trigger so the main RPC or application request can return sooner.