<@U04S8PLJWMT> I'm working on Postgres DB connecto...
# ask-ai
g
@kapa.ai I'm working on Postgres DB connectors synced to a Redshfit cluster; I'm analyzing results and I can't make much sense of the two columns: _ab_cdc_updated_at and _airbyte_extracted_at; sometimes one if after the other, sometimes one is before the other. On which of these should I base incremental updates to subsequent tables on?
k
The two columns you mentioned,
_ab_cdc_updated_at
and
_airbyte_extracted_at
, serve different purposes in Airbyte's CDC (Change Data Capture) syncs: - _ab_cdc_updated_at: This timestamp comes from the source database (Postgres in your case) and represents the last time the record was updated in the source. It is the "business" update time and is typically used as the cursor for incremental syncs, as it reflects when the data actually changed in the source system. - _airbyte_extracted_at: This timestamp is generated by Airbyte and indicates when the record was extracted (read) from the source and sent to the destination. It reflects the sync process timing, not the business data change. It's normal for these two columns to not always align: for example, a record might have been updated in the source at a certain time (
_ab_cdc_updated_at
), but Airbyte might extract it later (
_airbyte_extracted_at
), depending on your sync schedule and latency. For incremental updates to subsequent tables, you should base your logic on
_ab_cdc_updated_at
. This is because it accurately tracks when the data was last changed in the source, ensuring you capture all updates regardless of when Airbyte extracted them. Using
_airbyte_extracted_at
could cause you to miss updates that were made before the last extraction but not yet synced. This approach is consistent with Airbyte's documentation and best practices for incremental syncs, which recommend using a source-side "updated at" field as the cursor for tracking changes and performing incremental loads [Incremental sync](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/incremental-sync). If you need to track the sync process or debug extraction timing,
_airbyte_extracted_at
is useful, but for data change tracking and incremental logic, always use
_ab_cdc_updated_at
.
g
@kapa.ai is there a way for the
_ab_cdc_updated_at
column to be stored as timestamp instead of varchar? by default it is created as varchar
k
A message from kapa.ai
Based on the knowledge sources provided, by default, Airbyte stores the _ab_cdc_updated_at column as a
varchar
in destinations like Redshift and Snowflake. This can cause issues with sorting and comparison, especially if the string format is inconsistent (e.g., missing milliseconds), as described in user reports. Casting to a timestamp in queries is a common workaround to ensure correct ordering and comparison, but Airbyte does not natively store _ab_cdc_updated_at as a timestamp type out of the box [Normalization for Incremental Syncs](https://github.com/airbytehq/airbyte/issues/44860). There is currently no documented configuration or built-in feature in Airbyte to force _ab_cdc_updated_at to be stored as a timestamp instead of varchar in the destination. This limitation is due to Airbyte's type system, which prioritizes interoperability and often maps all string-like fields to
varchar
for maximum compatibility [[Postgres Source to Postgres Destination Connector overrides TEXT columns to VARCHAR](https://github.com/airbytehq/airbyte/issues/42906)]. If you require _ab_cdc_updated_at as a timestamp, you will need to cast it in your queries or perform a post-sync transformation in your destination database. There is no native Airbyte setting to change this behavior at this time.