Raihan Fathul Bayan
09/01/2025, 6:52 AMkapa.ai
09/01/2025, 6:52 AMsql CREATE USER airbyte PASSWORD 'your_password'; ALTER USER airbyte REPLICATION LOGIN; This user will be used by Airbyte to read data and access the replication stream. Also, grant this user SELECT privileges on the relevant schemas and tables: sql GRANT USAGE ON SCHEMA your_schema TO airbyte; GRANT SELECT ON ALL TABLES IN SCHEMA your_schema TO airbyte; ALTER DEFAULT PRIVILEGES IN SCHEMA your_schema GRANT SELECT ON TABLES TO airbyte; [Build an EL(T) from Postgres CDC (Step 2)](https://airbyte.com/tutorials/postgresql-change-data-capture-elt#step-2) 2. Enable logical replication on your PostgreSQL database: - For managed services (like Cloud SQL or RDS), set the appropriate flag (e.g., cloudsql.logical_decoding for Cloud SQL) to enable logical replication. - For self-hosted PostgreSQL, ensure the wal_level is set to logical in your postgresql.conf file. [Cloud SQL for PostgreSQL CDC Setup](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#setup-using-cdc) 3. Create a logical replication slot using the pgoutput plugin: sql SELECT pg_create_logical_replication_slot('airbyte_slot', 'pgoutput'); This slot will be used by Airbyte to stream changes. [Build an EL(T) from Postgres CDC (Step 2)](https://airbyte.com/tutorials/postgresql-change-data-capture-elt#step-2) 4. Set up replication identities for each table you want to replicate: sql ALTER TABLE your_table REPLICA IDENTITY DEFAULT; If your tables use large fields or TOASTed columns, consider: sql ALTER TABLE your_table REPLICA IDENTITY FULL; [Cloud SQL for PostgreSQL CDC Setup - Step 5](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#step-5-create-publication-and-replication-identities-for-each-postgres-table) 5. Create a publication including all tables you want to replicate: sql CREATE PUBLICATION airbyte_publication FOR TABLE table1, table2; [Cloud SQL for PostgreSQL CDC Setup - Step 5](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#step-5-create-publication-and-replication-identities-for-each-postgres-table) 6. Configure the Airbyte Postgres source connector: - In the Airbyte UI, select "Logical Replication (CDC)" as the replication mode. - Enter the replication slot and publication names you created above. [Cloud SQL for PostgreSQL CDC Setup - Step 6](https://docs.airbyte.com/integrations/sources/postgres/cloud-sql-postgres#step-6-enable-cdc-replication-in-airbyte-ui) Note: If you are using a managed PostgreSQL service (like AWS Aurora, TimescaleDB, or Azure PG Flex), review the [vendor-specific limitations](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#vendor-specific-connector-limitations) to ensure compatibility. By following these steps, your PostgreSQL instance will be ready for CDC-based replication to BigQuery via Airbyte.