I recently modified the cursor value of a dim tabl...
# replication-troubleshooting
l
I recently modified the cursor value of a dim table (let's call it C dim table) to a string column (similar to what I did for my other A &B dimension tables). During the initial sync, all rows were successfully loaded. I chose this string column because I expected it would often be updated or modified, and I wanted Airbyte to detect and migrate those changes (im using incremental-append as sync mode) Previously, I had been using an int column (no nulls, all unique) as the cursor for C dim table. While it worked, I noticed that some rows were being duplicated in the destination. This made me experiment with the string column approach, but, after reviewing the A & B dimension tables, I noticed a row count inconsistency. It looks like a new row was inserted in the source (Redshift), but the update wasn’t captured by Airbyte and therefore wasn’t loaded into the destination. This makes me think that using a string column as a cursor could cause problems in the future. From what I’ve read in the Airbyte forums and docs, it’s generally recommended to use a column that is monotonically increasing over time (like an integer ID or timestamp) as the cursor. They also suggest handling potential duplicates with the Incremental – Append + Deduped sync mode. That was actually my original plan, but I wanted to better understand the behavior of the cursor value before finalizing the setup. I'm actually confused because my int column is all unique records while the string column has duplicates. Has anyone run into a similar issue or can share best practices for choosing the right cursor column in cases like this?
k
You are correct that the choice of cursor column is critical for reliable incremental syncs in Airbyte. Based on the official documentation, here are the key points and best practices relevant to your situation: ### 1. Cursor Column Requirements - Monotonically Increasing: Airbyte’s incremental sync relies on the cursor column to identify new or updated records. The best practice is to use a column that is monotonically increasing (such as an auto-incrementing integer, a timestamp, or a similar field that always moves forward). This ensures that every new or updated record will have a cursor value greater than the last synced value, allowing Airbyte to reliably detect changes. - String Columns as Cursors: Using a string column as a cursor can be problematic unless you are certain that the string values are always strictly increasing and never repeat or go backward. If the string values are not guaranteed to be unique and ordered, Airbyte may miss updates or insert duplicates, as you observed. The documentation does not recommend using string columns for this purpose unless they meet these criteria. ### 2. Known Limitations - If the cursor field is not updated when a record is modified, Airbyte will not detect the change. The sync query typically looks like:
Copy code
sql   SELECT * FROM table WHERE cursor_field >= 'last_sync_max_cursor_field_value'
If a record is updated but its cursor value does not change (or is not greater than the last synced value), it will not be picked up in the next sync. This is a common pitfall when using non-monotonic or non-updated cursor fields, including some string columns. This can lead to missing updates in your destination, as you described [Known Limitations - Incremental Sync](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append#known-limitations). ### 3. Duplicates and Deduplication - Incremental – Append mode can result in duplicate rows if the cursor field is not unique or if the sync is run multiple times with the same cursor value (e.g., due to low granularity or inclusive cursors). This is expected behavior, as Airbyte provides an at-least-once delivery guarantee and may re-send some data if the cursor is ambiguous [Inclusive Cursors](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append#inclusive-cursors). - Incremental – Append + Deduped mode is recommended if you want to ensure only the latest version of each record (per primary key) is present in the destination. This mode requires you to define a primary key and a suitable cursor field. Airbyte will keep only the latest record for each primary key, sorted by the cursor value [Incremental Sync - Append + Deduped](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped). ### 4. Best Practices - Use a timestamp or integer column as the cursor whenever possible, especially one that is updated on every modification (e.g., an
updated_at
timestamp). - Avoid string columns as cursors unless you are certain they are strictly increasing and always updated on change. - Switch to Incremental – Append + Deduped mode if you want to avoid duplicates and ensure only the latest record per primary key is kept. - Ensure the cursor field is always updated when a record changes, or updates may be missed. ### Summary Your experience matches the documented behavior: using a non-monotonic or non-updated cursor (such as some string columns) can cause Airbyte to miss updates or create duplicates. The best practice is to use a monotonically increasing, always-updated field (like a timestamp or integer) as the cursor, and to use the deduplication sync mode if you want to avoid duplicates in the destination. For more details, see the official documentation on [Incremental Sync - Append](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append#known-limitations) and [Incremental Sync - Append + Deduped](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped#known-limitations).
l
I implemented the incremental + deduped mode on airbyte. i utilized id column which is an int column that is all unique and incrementing. however, there was an inconsistency in row count where the row count in destination is less than the source. does anyone have a similar experience?