PostgreSQL Heartbeats

Setup PostgreSQL heartbeats for low volume databases

For low volume PostgreSQL sources, it is possible that the log becomes stale due to a lack of change events. As a result, events may not be captured by the Connector.

To address this, the heartbeat process involves writing an insert or update to a heartbeat table every 1 second to generate a change event.

Setup PostgreSQL Heartbeats

Create the heartbeat table

CREATE TABLE heartbeat (
    id serial PRIMARY KEY,
    text text
);

Grant permission to the Streamkap user

GRANT INSERT, UPDATE ON heartbeat TO STREAMKAP_USER;

Include the heartbeat table in the topic list

  • Within Streamkap, go to the PostgreSQL Source and add the heartbeat table to the schema

Verify it's working

  • Streamkap should start inserting records to the heartbeat table using this command every 1 second
INSERT INTO heartbeat (text) VALUES ('test_heartbeat')
  • Look for entries in the heartbeat table to verify this is working