Asynchronous publish/subscribe messaging built into the database — no external message broker needed.

PostgreSQL publish/subscribe mechanism for asynchronous notifications between database sessions: LISTEN registers interest in a channel, NOTIFY sends a notification to all subscribers. Useful for cache invalidation, background job triggering, and event-driven architectures without polling.

Compatibility

Show:
Database System Support Status Since Version Notes
MySQL ✗ Not Supported Not supported. Use application-layer messaging (Redis pub/sub, etc.).
PostgreSQL ✓ Supported all LISTEN channel registers interest. NOTIFY channel [, payload] fires on transaction commit. Clients receive notifications via the connection. pg_notify(channel, payload) can be called from triggers or functions. Payload limited to ~8000 bytes. Works within a single database only.
SQL Server ✗ Not Supported Not supported as SQL. Service Broker provides similar functionality but with a very different architecture and syntax.
Oracle ✗ Not Supported Not supported as SQL. DBMS_ALERT and DBMS_PIPE PL/SQL packages provide async signaling but are PL/SQL-only.
SQLite ✗ Not Supported Not supported. SQLite is a single-process embedded database with no server process to hold pub/sub channels.

Details

Unique to PostgreSQL. Commonly used for cache invalidation, real-time job queue signaling, and live-update feeds — without any external infrastructure. Fires on COMMIT, not on the NOTIFY call itself.

Standard Syntax

-- Session 1 (subscriber): LISTEN order_updates; -- Session 2 (publisher): NOTIFY order_updates, '{"id": 42}';

Version Support

MySQL: Not supported PostgreSQL: Since all SQL Server: Not supported Oracle: Not supported SQLite: Not supported

Per-Database Syntax & Notes

MySQL

Not supported. Use application-layer messaging (Redis pub/sub, etc.).

-- Not supported.

PostgreSQL

LISTEN channel registers interest. NOTIFY channel [, payload] fires on transaction commit. Clients receive notifications via the connection. pg_notify(channel, payload) can be called from triggers or functions. Payload limited to ~8000 bytes. Works within a single database only.

-- Session 1: LISTEN order_updates; -- Session 2: NOTIFY order_updates, '{"id": 42, "status": "shipped"}'; -- From inside a trigger: SELECT pg_notify('order_updates', row_to_json(NEW)::text);

SQL Server

Not supported as SQL. Service Broker provides similar functionality but with a very different architecture and syntax.

-- Not supported. See Service Broker.

Oracle

Not supported as SQL. DBMS_ALERT and DBMS_PIPE PL/SQL packages provide async signaling but are PL/SQL-only.

-- Not supported as SQL. See DBMS_ALERT.

SQLite

Not supported. SQLite is a single-process embedded database with no server process to hold pub/sub channels.

-- Not supported.