Last updated: 03/26/2025

🛡️ Preventing WAL Growth with Heartbeats

This solution is specifically designed for low-traffic or idle databases. Active databases don’t need this feature as their WAL naturally resets with regular data changes.

Setup Steps

  1. Create and configure the heartbeat table:
-- Create the heartbeat table
CREATE TABLE test_heartbeat_table (id text PRIMARY KEY, ts timestamp);

-- Grant necessary permissions
GRANT UPDATE ON TABLE test_heartbeat_table TO artie_transfer;

-- Insert initial record
INSERT INTO test_heartbeat_table (id, ts) VALUES (1, NOW());
  1. Enable heartbeats in your deployment’s advanced settings.

Troubleshooting Guide

If you’re still experiencing WAL growth after enabling heartbeats, check these common issues:

1

Table Existence

Verify test_heartbeat_table exists in your database

2

Publication Configuration

-- Check if the table is included in your publication
-- For Artie deployments, the publication name should default
-- to `dbz_publication` (unless changed under Deployment advanced settings)
SELECT pubname, tablename
FROM pg_publication_tables
WHERE tablename = 'test_heartbeat_table';
3

Permission Issues

Confirm the service account has proper write permissions

4

Long-Running Queries

-- Check for queries that might block replication
SELECT
  pid,
  now() - pg_stat_activity.query_start AS duration,
  query,
  state
FROM pg_stat_activity
WHERE (now() - pg_stat_activity.query_start) > interval '1 minute';