LISTEN and NOTIFY provide a built-in publish/subscribe messaging system in PostgreSQL — one session can send a notification on a channel, and other sessions listening on that channel receive it instantly. It's a lightweight way to push real-time events from the database without polling.
The basic mechanism
LISTEN order_created;
NOTIFY order_created, ;
