Postgres has built-in mechanism for notifying clients (listeners) of events such as INSERT
, UPDATE
, and DELETE
on tables.
Note that for this to work, a listener must have a dedicated direct connection to Postgres. Connection poolers like pgbouncer would not work.
First, lets go over some key Postgres components:
triggers
- automatically executes some function when an event on a table occurschannels
- a communication mechanism identified by a string in postgres