data-peek
Features

PostgreSQL LISTEN/NOTIFY

Subscribe to PostgreSQL notification channels in real time

PostgreSQL LISTEN/NOTIFY

Monitor PostgreSQL pub/sub channels directly in data-peek with a live event stream.

LISTEN/NOTIFY is PostgreSQL’s built-in pub/sub: a trigger or an app fires NOTIFY channel, 'payload', and anyone listening gets it instantly. It’s great for cache invalidation, real-time UI updates, and job queues — but debugging it usually means writing a throwaway listener script. This panel is that listener, built in: subscribe to a channel and watch events stream in live, or fire test notifications to check your consumers react.

Opening the Panel

Open the Notifications panel from the sidebar. It opens as a dedicated tab.

Subscribing to Channels

  1. Type a channel name in the input field
  2. Click Subscribe or press Enter
  3. You can subscribe to multiple channels simultaneously

Viewing Events

Events appear in real time as they arrive:

  • Timestamp with millisecond precision
  • Channel name
  • Payload content
  • JSON payloads are automatically pretty-printed

Sending Notifications

Send a NOTIFY message from within the panel:

  1. Enter the channel name
  2. Enter the payload (optional)
  3. Click Send

This is useful for testing notification consumers.

Actions

  • Copy — copy a notification payload to clipboard
  • Clear All — remove all received events from the display

Example: watching a trigger fire

Subscribe to a channel — say orders_changed — then, from a Query Editor tab (or the panel’s Send), fire:

NOTIFY orders_changed, '{"id": 4821, "status": "paid"}';

The event shows up in the stream instantly, timestamped, with the JSON payload pretty-printed. Wire the same NOTIFY into an AFTER INSERT trigger and you can watch your database emit events in real time as data changes — the fastest way to confirm a trigger actually fires and carries the payload you expect.

This feature is PostgreSQL-only, as LISTEN/NOTIFY is a PostgreSQL-specific feature. Payloads are capped at 8000 bytes by Postgres itself — send an id and look the row up, rather than stuffing the whole record into the payload.

  • Triggers — fire NOTIFY automatically on data changes
  • Query Editor — run NOTIFY / set up LISTEN manually
  • Watch Mode — poll a query on a cadence when pub/sub isn’t a fit

On this page