Snowflake as a destination is deprecated and no longer actively maintained. It remains fully functional and no code is currently being removed. For new mirrors, we recommend ClickHouse, ClickHouse Cloud, or Postgres as the destination.
Let’s look at how we can seamlessly perform Change-Data Capturing (CDC) from PostgreSQL to Snowflake.
Suppose you have a banking application running on PostgreSQL. There are two tables: “users” and “transactions.” You want to sync these tables in real-time to Snowflake for analytics purposes, such as real-time fraud detection. Let’s see how we can make this happen within a few minutes and a few SQL commands using PeerDB.
Run the following commands to let PeerDB know about the existing Postgres and Snowflake Peers.
-- Connect to PeerDBpsql "port=9900 host=localhost password=peerdb"-- Add Postgres and Snowflake peersCREATE PEER postgres_peer FROM postgres (...);CREATE PEER snowflake_peer FROM snowflake (...);
Make sure to replace (…) with the appropriate connection details for both the PostgreSQL and Snowflake instances. More details on adding PEERs are available here.
You must set the staging path to be an existing S3 bucket URL, or an empty string for PeerDB to stage the AVRO files internally.If you observe, TABLE MAPPING represents the table name mapping between the two Postgres peers. The final WITH clause captures if you wanted to include initial snapshot as a part of the MIRROR. If you don’t include that WITH, PeerDB assumes that you don’t want to perform an initial snapshot. If just reads the slot and replays the changes to the target.
If you want additional types to be supported or want to alter the existing data type mapping, please reach out to us. We can aim to support that within a few days. Also, PeerDB is fully open source, so feel free to submit a PR.
PeerDB also supports replicating TOAST columns very efficiently. Unlike most CDC tools, you don’t need to set up REPLICA IDENTITY FULL for replicating TOAST columns. This PR captures the infrastructural optimizations that PeerDB takes to support TOAST columns.
You can use the UI (localhost:3000) to monitor the status of the initial load. Refer to the below video:
You can use the UI (localhost:3000) to monitor the status of the Change Data Capture (CDC). Refer to the below video:
For deeper monitoring, you can connect to localhost:8085 to get full visibility into the different jobs and steps that PeerDB is taking under the covers to manage the MIRROR.
To make it easy in your development and test environments, PeerDB also introduces the DROP MIRROR command. DROP MIRROR drops all the underlying objects that CREATE MIRROR generates. More details are available in this PR.
-- drop the mirrorDROP MIRROR real_time_cdc;
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"PeerDB Docs: Setup your ETL in minutes with SQL.","colors":{"primary":"#248736","light":"#248736","dark":"#248736"},"favicon":"https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/favicon.png?fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=bcb6625d7fc622364e8380f49bc07790","logo":{"light":"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-light.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=90ac5de385106617a465b7ba4d33a28e","dark":"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-dark.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=feffd926023e0bcf9c5d4282d426fe12"},"navbar":{"primary":{"type":"button","label":"Get Started","href":"https://app.peerdb.cloud"}},"footer":{"socials":{"github":"https://github.com/PeerDB-io"}},"integrations":{"ga4":{"measurementId":"G-1V9ZZCZMB7"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"peerdb","hasAudioNarration":false,"actualSubdomain":"peerdb","customDomains":["docs.peerdb.io"],"gitSource":{"type":"github","owner":"peerdb-io","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a8893018e352becf1ac8d39","collectionId":"dc037637-3209-4796-8664-2e77fd9c1f6c","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6a8893018e352becf1ac8d39"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6a8893018e352becf1ac8d39:success","clientVersion":"0.0.4021","searchFilterCounts":[{"language":"default","tag":"Documentation","count":75},{"language":"default","tag":"Setup","count":17},{"language":"default","tag":"API Reference","count":14},{"language":"default","tag":"API Endpoints","count":14},{"language":"default","tag":"Use-cases","count":12},{"language":"default","tag":"SQL Reference","count":10},{"language":"default","tag":"SQL Commands","count":10},{"language":"default","tag":"PostgreSQL Setup Guide","count":9},{"language":"default","tag":"Features","count":9},{"language":"default","tag":"Mirror","count":9}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"usecases/real-time-cdc/postgres-to-snowflake","slug":"/usecases/real-time-cdc/postgres-to-snowflake","pageMetadata":{"title":"PostgreSQL To Snowflake","description":null,"href":"/usecases/real-time-cdc/postgres-to-snowflake"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,blockquote:`blockquote`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedFrame,OptimizedImage,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedFrame)_missingMdxReference(`OptimizedFrame`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsx(_components.p,{children:`Snowflake as a destination is deprecated and no longer actively maintained. It remains fully functional and no code is currently being removed. For new mirrors, we recommend ClickHouse, ClickHouse Cloud, or Postgres as the destination.`})}),`\n`,_jsx(_components.p,{children:`Let’s look at how we can seamlessly perform Change-Data Capturing (CDC) from PostgreSQL to Snowflake.`}),`\n`,_jsx(Heading,{level:`3`,id:`scenario`,children:`Scenario`}),`\n`,_jsx(_components.p,{children:`Suppose you have a banking application running on PostgreSQL. There are two tables: “users” and “transactions.” You want to sync these tables in real-time to Snowflake for analytics purposes, such as real-time fraud detection. Let’s see how we can make this happen within a few minutes and a few SQL commands using PeerDB.`}),`\n`,_jsx(Heading,{level:`3`,id:`demo`,children:`Demo`}),`\n`,_jsx(_components.p,{children:`This demo shows PeerDB syncing a table with 100 million rows from PostgreSQL to Snowflake in few minutes.`}),`\n`,_jsx(`div`,{style:{position:`relative`,paddingBottom:`56.25%`,height:0},children:_jsx(OptimizedFrame,{src:`https://www.loom.com/embed/a872562608864995b9016e67c3221693?sid=6d342a2c-2f44-49f6-8765-1db03c133f7e`,frameBorder:0,webkitallowfullscreen:``,mozallowfullscreen:``,allowFullScreen:``,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`}})}),`\n`,_jsx(Heading,{level:`3`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Enable logical decoding in Postgres. Ensure that the following settings/GUCs are properly configured:`,`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`wal_level: logical`}),`\n`,_jsx(_components.li,{children:`max_wal_senders: >1`}),`\n`,_jsx(_components.li,{children:`max_replication_slots: 4`}),`\n`]}),`\n`]}),`\n`,_jsx(_components.li,{children:`Enable replication access for a PostgreSQL user - ALTER USER pg_user REPLICATION;`}),`\n`,_jsx(_components.li,{children:`Ensure that both tables have primary keys. Composite primaries are also fine. If not, make sure your tables have REPLICA IDENTITY FULL.`}),`\n`,_jsxs(_components.li,{children:[`If you are using PostgreSQL on the cloud, below links capture how to enable logical replication for each cloud:`,`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Replication.Logical.html#AuroraPostgreSQL.Replication.Logical.Configure`,children:`AWS RDS and Aurora PostgreSQL`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://learn.microsoft.com/azure/postgresql/flexible-server/concepts-logical#pre-requisites-for-logical-replication-and-logical-decoding`,children:`Azure Database for PostgreSQL - Flexible Server`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://cloud.google.com/sql/docs/postgres/replication/configure-logical-replication#configure-your-postgresql-instance`,children:`GCP Cloud SQL PostgreSQL`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Ensure that permissions for the Snowflake user and database you wish to use is properly configured. More details are available `,_jsx(_components.a,{href:`/sql/commands/create-peer#granting-permissions`,children:`here`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`step-1-add-postgres-and-snowflake-peers`,children:`Step 1: Add Postgres and Snowflake Peers`}),`\n`,_jsx(_components.p,{children:`Run the following commands to let PeerDB know about the existing Postgres and Snowflake Peers.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- Connect to PeerDB`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`psql `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"port=9900 host=localhost password=peerdb\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- Add Postgres and Snowflake peers`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PEER postgres_peer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` postgres (...);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PEER snowflake_peer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` snowflake (...);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Make sure to replace `,_jsx(_components.strong,{children:_jsx(_components.code,{children:`(…)`})}),` with the appropriate connection details for both the PostgreSQL and Snowflake instances. More details on adding PEERs are available `,_jsx(_components.a,{href:`/sql/commands/create-peer`,children:`here`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`step-2-real-time-cdc-from-postgresql-to-snowflake`,children:_jsx(_components.strong,{children:`Step 2: Real-Time CDC from PostgreSQL to Snowflake`})}),`\n`,_jsx(_components.p,{children:`With the peers set up, you can create a mirror that facilitates real-time CDC from PostgreSQL to Snowflake.`}),`\n`,_jsx(Heading,{level:`4`,id:`create-mirror-using-sql`,children:`Create MIRROR using SQL`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- Real-time CDC from PostgreSQL to Snowflake`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MIRROR real_time_cdc`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` postgres_peer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` snowflake_peer`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WITH`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MAPPING (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`transactions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`transactions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`users`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`users`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- make sure tables are schema qualified`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WITH`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` do_initial_copy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` true,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` snapshot_sync_mode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'avro'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` snapshot_num_rows_per_partition `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 500000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` snapshot_max_parallel_workers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` snapshot_num_tables_in_parallel `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` snapshot_staging_path `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ''`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Since no CDC sync mode has been specified above, CDC will be performed in `,_jsx(_components.code,{children:`sql`}),` mode.`]}),`\n`,_jsxs(_components.p,{children:[`To perform CDC via `,_jsx(_components.code,{children:`AVRO mode`}),`, you must set the following:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` cdc_sync_mode = 'avro'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` cdc_staging_path = '\u003cstage>'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`You must set the staging path to be an existing S3 bucket URL, or an empty string for PeerDB to stage the AVRO files internally.`}),`\n`,_jsxs(_components.p,{children:[`If you observe, `,_jsx(_components.strong,{children:`TABLE MAPPING`}),` represents the table name mapping between the two Postgres peers. The final `,_jsx(_components.code,{children:`WITH`}),` clause captures if you wanted to include initial snapshot as a part of the MIRROR. If you don’t include that `,_jsx(_components.code,{children:`WITH`}),`, PeerDB assumes that you don’t want to perform an initial snapshot. If just reads the slot and replays the changes to the target.`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Data type mapping between `,_jsx(_components.a,{href:`/datatypes/datatype-matrix`,children:`Postgres and Snowflake can be found here`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`If you want additional types to be supported or want to alter the existing data type mapping, please reach out to us. We can aim to support that within a few days. Also, PeerDB is `,_jsx(_components.a,{href:`https://github.com/PeerDB-io/peerdb`,children:`fully open source`}),`, so feel free to submit a PR.`]}),`\n`]}),`\n`,_jsxs(_components.blockquote,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`PeerDB also supports replicating TOAST columns very efficiently`}),`. Unlike most CDC tools, you don’t need to set up REPLICA IDENTITY FULL for replicating TOAST columns. This `,_jsx(_components.a,{href:`https://github.com/PeerDB-io/peerdb/pull/111`,children:`PR`}),` captures the infrastructural optimizations that PeerDB takes to support TOAST columns.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`create-mirror-using-ui`,children:`Create MIRROR using UI`}),`\n`,_jsx(_components.p,{children:`If you prefer a UI, you can easily create a mirror using the PeerDB UI (localhost:3000). Refer to the below video:`}),`\n`,_jsx(`div`,{style:{position:`relative`,paddingBottom:`56.25%`,height:0},children:_jsx(OptimizedFrame,{src:`https://www.loom.com/embed/81d40e8dae854ef5ab8c97c7eeda5e2e?sid=268af7c2-a8dc-465f-9ceb-a61e52ab7b1e`,frameBorder:0,webkitallowfullscreen:``,mozallowfullscreen:``,allowFullScreen:``,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`}})}),`\n`,_jsx(Heading,{level:`3`,id:`step-3-validate-the-mirror`,children:_jsx(_components.strong,{children:`Step 3: Validate the Mirror`})}),`\n`,_jsx(_components.p,{children:`Through the same PeerDB’s Postgres-compatible SQL interface, you can quickly validate the MIRROR (real-time CDC).`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- Validate the mirror`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` COUNT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` snowflake_peer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`transactions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` COUNT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` postgres_peer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`transactions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`step-4-monitor-the-mirror`,children:`Step 4: Monitor the MIRROR`}),`\n`,_jsx(_components.p,{children:`You can use the UI (localhost:3000) to monitor the status of the initial load. Refer to the below video:`}),`\n`,_jsx(`div`,{style:{position:`relative`,paddingBottom:`56.25%`,height:0},children:_jsx(OptimizedFrame,{src:`https://www.loom.com/embed/74589a20661d42b88bdc82d0368b44cd?sid=96804563-5126-45d6-b4f2-8cdbc34ba442`,frameBorder:0,webkitallowfullscreen:``,mozallowfullscreen:``,allowFullScreen:``,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`}})}),`\n`,_jsx(_components.p,{children:`You can use the UI (localhost:3000) to monitor the status of the Change Data Capture (CDC). Refer to the below video:`}),`\n`,_jsx(`div`,{style:{position:`relative`,paddingBottom:`56.25%`,height:0},children:_jsx(OptimizedFrame,{src:`https://www.loom.com/embed/75e95b2d0a404c66add26ef82c129f54?sid=284b1198-a854-4e6a-a660-6ae5a0fa898a`,frameBorder:0,webkitallowfullscreen:``,mozallowfullscreen:``,allowFullScreen:``,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`}})}),`\n`,_jsxs(_components.p,{children:[`For deeper monitoring, you can connect to `,_jsx(_components.code,{children:`localhost:8085`}),` to get full visibility into the different jobs and steps that PeerDB is taking under the covers to manage the MIRROR.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=a455add3d1435f5cb4eeeb4a1d8dda90`,alt:`Managing Mirror`,\"data-og-width\":`1768`,width:`1768`,\"data-og-height\":`831`,height:`831`,\"data-path\":`images/managing_mirror.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=280\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=f862e37699beeca08b45a8011569e0a6 280w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=560\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=836aa1545e9b5f20ae2433c0ec200744 560w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=840\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=da72c888007094b25a8f0a3873a12a30 840w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=1100\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=63a15f01f5ea782c193ceeca6013faf1 1100w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=1650\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=e930aa56147a73b51a3bf3524a35e8a1 1650w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=2500\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=d38fe97d9f35f03343ad79ad8bebcfc6 2500w`}),`\n`,_jsx(Heading,{level:`3`,id:`step-5-drop-mirror`,children:`Step 5: DROP MIRROR`}),`\n`,_jsxs(_components.p,{children:[`To make it easy in your development and test environments, PeerDB also introduces the DROP MIRROR command. DROP MIRROR drops all the underlying objects that CREATE MIRROR generates. More details are available in this `,_jsx(_components.a,{href:`https://github.com/PeerDB-io/peerdb/pull/93`,children:`PR`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- drop the mirror`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DROP`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MIRROR real_time_cdc;`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"PostgreSQL To Snowflake","description":null,"href":"/usecases/real-time-cdc/postgres-to-snowflake"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Scenario","slug":"scenario","depth":3,"children":[]},{"title":"Demo","slug":"demo","depth":3,"children":[]},{"title":"Prerequisites","slug":"prerequisites","depth":3,"children":[]},{"title":"Step 1: Add Postgres and Snowflake Peers","slug":"step-1-add-postgres-and-snowflake-peers","depth":3,"children":[]},{"title":"Step 2: Real-Time CDC from PostgreSQL to Snowflake","slug":"step-2-real-time-cdc-from-postgresql-to-snowflake","depth":3,"children":[]},{"title":"Create MIRROR using SQL","slug":"create-mirror-using-sql","depth":4,"children":[]},{"title":"Create MIRROR using UI","slug":"create-mirror-using-ui","depth":4,"children":[]},{"title":"Step 3: Validate the Mirror","slug":"step-3-validate-the-mirror","depth":3,"children":[]},{"title":"Step 4: Monitor the MIRROR","slug":"step-4-monitor-the-mirror","depth":3,"children":[]},{"title":"Step 5: DROP MIRROR","slug":"step-5-drop-mirror","depth":3,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"peerdb","siteName":"PeerDB Docs: Setup your ETL in minutes with SQL.","title":"PostgreSQL To Snowflake - PeerDB Docs: Setup your ETL in minutes with SQL.","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-21T18:07:54.650Z","originalFileLocation":"usecases/real-time-cdc/postgres-to-snowflake.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"PostgreSQL To Snowflake - PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://peerdb.mintlify.app/_mintlify/api/og/v2?division=Real-time+Change+Data+Capture+from+Postgres\u0026amp;title=PostgreSQL+To+Snowflake\u0026amp;theme=fca96d2023807749157a0c65\u0026amp;signature=18ab9c797888c2d4741ac00497d88c6638f14747d1ad6f54045b72b9a4703049\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"PostgreSQL To Snowflake - PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://peerdb.mintlify.app/_mintlify/api/og/v2?division=Real-time+Change+Data+Capture+from+Postgres\u0026amp;title=PostgreSQL+To+Snowflake\u0026amp;theme=fca96d2023807749157a0c65\u0026amp;signature=18ab9c797888c2d4741ac00497d88c6638f14747d1ad6f54045b72b9a4703049\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#248736\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/usecases/real-time-cdc/postgres-to-snowflake.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.peerdb.io/#organization\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"url\":\"https://docs.peerdb.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-light.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=90ac5de385106617a465b7ba4d33a28e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.peerdb.io#website\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"url\":\"https://docs.peerdb.io\",\"publisher\":{\"@id\":\"https://docs.peerdb.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake#webpage\",\"url\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake\",\"name\":\"PostgreSQL To Snowflake\",\"dateModified\":\"2026-08-21T18:07:54.650Z\",\"isPartOf\":{\"@id\":\"https://docs.peerdb.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Use-cases\",\"item\":\"https://docs.peerdb.io/usecases/real-time-cdc/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Real-time Change Data Capture from Postgres\",\"item\":\"https://docs.peerdb.io/usecases/real-time-cdc/overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PostgreSQL To Snowflake\",\"item\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake#article\",\"headline\":\"PostgreSQL To Snowflake\",\"name\":\"PostgreSQL To Snowflake\",\"url\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake\",\"mainEntityOfPage\":{\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-snowflake#webpage\"},\"dateModified\":\"2026-08-21T18:07:54.650Z\",\"publisher\":{\"@id\":\"https://docs.peerdb.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.peerdb.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"PeerDB Docs: Setup your ETL in minutes with SQL.","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Home","pages":[{"title":"PeerDB","href":"/introduction"},{"title":"Architecture Overview","href":"/architecture"},{"title":"Why choose PeerDB over other tools?","href":"/why-peerdb"}]},{"group":"Quickstart","pages":[{"title":"Quickstart Guide","href":"/quickstart/quickstart"},{"title":"PeerDB Streams for Kafka Quickstart Guide","href":"/quickstart/streams-quickstart"},{"title":"SQL Quickstart Guide","href":"/quickstart/sql-quickstart"}]},{"group":"PeerDB Cloud","pages":[{"title":"PeerDB Cloud Quickstart Guide","icon":"rocket","iconType":"solid","href":"/peerdb-cloud/cloud-quickstart"},{"title":"PeerDB Cloud Security","icon":"lock","iconType":"solid","href":"/peerdb-cloud/cloud-security"},{"title":"PeerDB Cloud Pricing FAQ","icon":"question","iconType":"solid","href":"/peerdb-cloud/peerdb-cloud-pricing-faq"},{"title":"Trust Center","url":"https://trust.peerdb.io/","icon":"shield-halved","iconType":"solid","href":"/peerdb-cloud/cloud-trust-center"},{"title":"Public IPs For PeerDB Cloud","icon":"server","iconType":"regular","href":"/peerdb-cloud/ip-table"},{"title":"AWS Private Link","icon":"diagram-project","iconType":"solid","href":"/peerdb-cloud/aws-private-link"}]},{"group":"Setup","pages":[{"group":"PostgreSQL Setup Guide","pages":[{"title":"RDS Postgres Source Setup Guide","href":"/connect/postgres/rds_postgres"},{"title":"Supabase Postgres Source Setup Guide on PeerDB Cloud","href":"/connect/postgres/supabase_postgres_peerdb_cloud"},{"title":"Supabase Postgres Source Setup Guide","href":"/connect/postgres/supabase_postgres"},{"title":"Google CloudSQL Postgres Source Setup Guide","href":"/connect/postgres/cloudsql_postgres"},{"title":"Azure Flexible Server Postgres Source Setup Guide","href":"/connect/postgres/azure_flexible_server_postgres"},{"title":"Crunchy Bridge Postgres Source Setup Guide","href":"/connect/postgres/crunchy_bridge"},{"title":"Neon Postgres Source Setup Guide","href":"/connect/postgres/neon_postgres"},{"title":"Generic PostgreSQL Source Setup Guide","href":"/connect/postgres/generic_postgres"},{"title":"Unsupported PostgreSQL Providers","href":"/connect/postgres/unsupported_providers"}]},{"title":"CockroachDB Source Setup Guide","href":"/connect/cockroachdb"},{"group":"Clickhouse Setup Guide","pages":[{"title":"ClickHouse Cloud Setup Guide","href":"/connect/clickhouse/clickhouse-cloud"},{"title":"ClickHouse Setup Guide","href":"/connect/clickhouse/clickhouse"}]},{"title":"Snowflake Setup Guide","href":"/connect/snowflake"},{"title":"BigQuery Setup Guide","href":"/connect/bigquery"},{"title":"GCS Setup Guide","href":"/connect/gcs"},{"title":"S3 Setup Guide","href":"/connect/s3"},{"title":"Elasticsearch Setup Guide","href":"/connect/elasticsearch"}]},{"group":"Queues Setup","pages":[{"title":"Kafka Setup Guide","href":"/connect/kafka"},{"title":"Confluent Cloud Setup Guide","href":"/connect/confluent-cloud"},{"title":"PubSub Setup Guide","href":"/connect/pubsub"}]},{"group":"Mirror","pages":[{"title":"CDC Setup from Postgres to ClickHouse","href":"/mirror/cdc-pg-clickhouse"},{"title":"CDC Setup from Supabase to ClickHouse","href":"/mirror/cdc-supabase-clickhouse"},{"title":"CDC Setup from Neon Postgres to ClickHouse","href":"/mirror/cdc-neon-clickhouse"},{"title":"CDC Setup from Postgres to Bigquery","href":"/mirror/cdc-pg-bq"},{"title":"CDC Setup from Postgres to Snowflake","href":"/mirror/cdc-pg-sf"},{"title":"CDC Setup from Postgres to Postgres","href":"/mirror/cdc-pg-pg"},{"title":"CDC Setup from Postgres to Kafka","href":"/mirror/cdc-pg-kafka"},{"title":"CDC Setup from Postgres to Elasticsearch","href":"/mirror/cdc-pg-elasticsearch"},{"title":null,"href":"/mirror/upgrade"}]},{"group":"5-minute Tutorials","pages":[{"title":"Streaming Query Replication of PostgreSQL To Snowflake","href":"/tutorials/realtime-streaming-of-query-results"}]},{"group":"Features","pages":[{"title":"Pausing a CDC Mirror","href":"/features/pause-mirror"},{"title":"Editing a CDC Mirror","href":"/features/edit-mirror"},{"title":"Resyncing a CDC Mirror","href":"/features/resync-mirror"},{"title":"Schema Changes Propagation Support","href":"/features/schema-changes"},{"title":null,"href":"/features/replicating-partitioned-tables"},{"title":null,"href":"/features/feature-matrix"},{"title":null,"href":"/features/supported-connectors"},{"group":"Alerting","pages":[{"title":"Slack Alerting","href":"/features/alerting/slack-alerting"},{"title":"Email Alerting","href":"/features/alerting/email-alerting"}]}]},{"group":"Data types","pages":[{"title":null,"href":"/datatypes/datatype-matrix"}]},{"group":"Best practices","pages":[{"title":"Postgres to ClickHouse: Data Modeling Tips","href":"/bestpractices/clickhouse_datamodeling"},{"title":"Heartbeat Table For CDC","href":"/bestpractices/heartbeat"},{"title":"Upgrading the PostgreSQL Peer Of An Ongoing CDC Mirror","href":"/bestpractices/postgres-upgrade"},{"title":"Generated Columns: Gotchas and Best Practices","href":"/bestpractices/generated_columns"},{"title":"Postgres to ClickHouse: Handling TOAST Columns","href":"/bestpractices/clickhouse_toast_columns"},{"title":"Defining the Ordering Key in ClickHouse differently from the Primary Key in Postgres","href":"/bestpractices/ordering-key-different"}]},{"group":"Use-cases","pages":[{"group":"Real-time Change Data Capture from Postgres","pages":[{"title":"Overview","href":"/usecases/real-time-cdc/overview"},{"title":"PostgreSQL To PostgreSQL","href":"/usecases/real-time-cdc/postgres-to-postgres"},{"title":"PostgreSQL to BigQuery","description":null,"href":"/usecases/real-time-cdc/postgres-to-bigquery"},{"title":"PostgreSQL To Snowflake","href":"/usecases/real-time-cdc/postgres-to-snowflake"},{"title":"PostgreSQL To Azure Event Hubs","description":null,"href":"/usecases/real-time-cdc/postgres-to-azure-eventhubs"},{"title":"PostgreSQL To AWS S3 And Google Cloud Storage","href":"/usecases/real-time-cdc/postgres-to-cloud"}]},{"group":"Streaming Query Replication","pages":[{"title":"Overview","href":"/usecases/streaming-query-replication/overview"},{"title":"PostgreSQL to PostgreSQL","href":"/usecases/streaming-query-replication/postgres-to-postgres"},{"title":"PostgreSQL to BigQuery","href":"/usecases/streaming-query-replication/postgres-to-bigquery"},{"title":"PostgreSQL to S3","href":"/usecases/streaming-query-replication/postgres-to-s3"},{"title":"PostgreSQL to Snowflake","href":"/usecases/streaming-query-replication/postgres-to-snowflake"}]},{"title":"Query Federation via PostgreSQL","href":"/usecases/postgres-compatible-layer-for-bigquery-and-snowflake"}]},{"group":"Benchmarks","pages":[{"title":null,"href":"/benchmarks/benchmarking-Postgres-Replication:-PeerDB-vs-Airbyte"}]},{"group":"Contributing","pages":[{"title":"Running Flow tests","href":"/dev/running-tests"}]},{"group":"Metrics and Tuning","pages":[{"title":"Config Tuning for Change Data Capture (CDC)","href":"/metrics/important_cdc_configs"},{"title":"Native Metrics","href":"/metrics/native-metrics"}]},{"group":"FAQs","pages":[{"title":"Frequently Asked Questions","href":"/faqs/faqs"}]}]},{"anchor":"SQL Reference","icon":"rectangle-terminal","pages":[{"title":"SQL Reference","href":"/sql/reference"}]},{"anchor":"API Reference","icon":"browser","pages":[{"title":"API Reference","href":"/peerdb-api/reference"}]},{"anchor":"Lua Reference","icon":"file-code","pages":[{"title":"Lua Reference","href":"/lua/reference"}]},{"anchor":"GitHub","href":"https://github.com/PeerDB-io/peerdb","icon":"github"},{"anchor":"Changelog","href":"https://github.com/PeerDB-io/peerdb/releases","icon":"list"},{"anchor":"Community","href":"https://slack.peerdb.io","icon":"slack"}]},"title":"PostgreSQL To Snowflake - PeerDB Docs: Setup your ETL in minutes with SQL.","buildId":"dpl_EnxDqhjaNc9a8MVa833TGULPd9uJ","deploymentId":"dpl_EnxDqhjaNc9a8MVa833TGULPd9uJ","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-CVZVK4hN.js","lightbox-handle-r17bVUz3.js"]}