This guide shows you how to set up change retention in Sequin to store change messages (inserts, updates, and deletes) in your database.

By the end of this guide, you’ll have a table that stores change messages. Then, you can stream those changes to a Sequin sink and have the ability to backfill changes at any time.

Prerequisites

Before you begin, make sure you have:

Steps

Open the Sequin web console and navigate to the Change Retention tab. Click “Create retention”.

Configure source

1

Select the source table

Select the table you want to capture changes from.

2

Configure filters

Optionally, specify which operations to capture (e.g., insert, update, and/or delete). You can also add column filters to capture only certain changes.

Configure destination

If you’ve created a change event table previously, you can select it from the list.

Otherwise, click Create new change event table to create a new table. This will open a modal that guides you through creating the table:

1

Choose a retention policy

Choose a retention policy for change messages.

If you’re not sure what to choose, we recommend selecting “None” and setting up a retention policy later.

2

Run the DDL commands

Copy the DDL commands from the modal and run them in your database.

3

Create the retention

Give your change retention a name, and click Create.

For more details on the options available, see the reference.

Verify

Test that changes are being captured correctly:

  1. Connect to your database
  2. Make a test change to your source table:
-- Example: Insert a new row
insert into your_table (column1, column2) 
values ('test1', 'test2');
  1. Verify the change was captured into the destination table:
select action, record_pk, record, changes
from sequin_changes
order by id desc
limit 1;

Next steps

Now that you’ve set up change retention, you can stream changes to a sink. With retention enabled, you can backfill changes to your sink at any time.

For more information about change retention, see the reference.