Snowflake Postgres: Low-Latency CDC for Real-Time AI Analytics
For years, developers have faced a difficult choice: the speed and familiarity of PostgreSQL for building apps, or the massive scale and analytical power of Snowflake for data insights. These two worlds often lived in silos, connected by fragile ETL pipelines that introduced lag, cost, and complexity.
Today, Snowflake announced that Snowflake Postgres is officially in Public Preview. You can now run a fully-featured, enterprise-grade Postgres database directly within the Snowflake AI Data Cloud.
What is Snowflake Postgres?
This isn’t a “Postgres-compatible” imitation. This is native PostgreSQL delivered as a managed service within Snowflake. It allows you to “Lift and Shift” existing applications to Snowflake with little to no migration effort.
By running Postgres on Snowflake, you get the world’s most popular open-source database combined with Snowflake’s unified security, governance, and global footprint. Snowflake Postgres isn’t just a place to store rows; it’s a platform for modern, intelligent applications. AI-Ready with pg_vector: Build RAG (Retrieval-Augmented Generation) applications and store vector embeddings right alongside your operational data. Geospatial Power with PostGIS: Leverage the industry standard for location-based data and complex geographic queries. Ecosystem Compatibility: Connect using any standard Postgres client, ORM, or driver. Whether you use psql, DBeaver, or a custom Python/Node.js app, it "just works."
Enterprise-Grade Features from Day One
The Public Preview launch includes the critical features needed to run demanding workloads reliably and securely:
- High Availability & Performance: Ensure your apps stay online with read replicas and automated failover capabilities.
- Data Protection: Sleep easy with Point-in-Time Recovery (PITR) and automated backups to protect against accidental data loss.
- Robust Security: Deep integration with Snowflake’s security stack, including Private Link support and Customer-Managed Keys (Tri-Secret Secure).
- Managed Management: Snowflake handles the heavy lifting — patching, scaling, and infrastructure — so you can focus on writing code.
See how you can combine the power of Snowflake Postgres with OpenFlow to stand up a high-performance CDC pipeline in minutes.
Creating a Postgres Database in Snowflake
From a security perspective, let’s create a network policy to control where Postgres can be accessed from. For this demo, I’ll allow access from the public internet.
use role accountadmin;
grant CREATE POSTGRES INSTANCE ON ACCOUNT TO role sysadmin;
use role sysadmin;
create database if not exists pg_network_database;
create schema if not exists pg_network_schema;
use pg_network_database.pg_network_schema;
CREATE OR REPLACE NETWORK RULE POSTGRES_INGRESS_RULE_POSTGRES
TYPE = IPV4,
MODE = POSTGRES_INGRESS,
VALUE_LIST = ('0.0.0.0/0');
CREATE NETWORK POLICY POSTGRES_INGRESS_POLICY
ALLOWED_NETWORK_RULE_LIST = (POSTGRES_INGRESS_RULE_POSTGRES);Now let’s create a Postgres database instance in Snowflake:
CREATE POSTGRES INSTANCE postgres_demo
COMPUTE_FAMILY = STANDARD_M
STORAGE_SIZE_GB = 10
AUTHENTICATION_AUTHORITY = POSTGRES
POSTGRES_VERSION = 17
HIGH_AVAILABILITY = FALSE
NETWORK_POLICY = POSTGRES_INGRESS_POLICY
COMMENT = 'Snowflake Postgres 17, No-HA 10GB';
-- Please note the output of the command as it has passwords of two users,
-- and hostname
-- Postgres database will be created in few minutes.
{
"application" : "xxxx",
"snowflake_admin" : "xxxx"
}
-- use command to see services and its config
SHOW POSTGRES SERVICES;
DESCRIBE POSTGRES SERVICE POSTGRES_DEMO;
-- if you want to secure postgres and change network policy
-- assume policy already exists in Snowflake acocunt
ALTER POSTGRES SERVICE POSTGRES_DEMO
SET NETWORK_POLICY = POSTGRES_CORP_VPN_POLICY;
-- create target database in Snowflake,
-- this is use to replicate data from Postgres
CREATE or REPLACE DATABASE RETAILCDC_DB;We’ll use OpenFlow for CDC, so when creating the OpenFlow runtime, we need an external access integration that allows OpenFlow to connect to Posrgres.
CREATE OR REPLACE NETWORK RULE OPENFLOW_POSTGRES_NETWORK_RULE
MODE = EGRESS
TYPE = HOST_PORT
VALUE_LIST = ('*.postgres.snowflake.app:5432');
CREATE OR REPLACE EXTERNAL ACCESS INTEGRATION OPENFLOW_POSTGRES_EAI
ALLOWED_NETWORK_RULES = (OPENFLOW_POSTGRES_NETWORK_RULE)
ENABLED = TRUE;That’s everything required on the Snowflake side. You can now connect to Postgres using tools such as psql or pgAdmin, create a new demo database, load some data, and enable replication. Once connected to Postgres, run the following command in the query tool using the snowflake_admin credentials.
CREATE DATABASE demodb;
CREATE USER demouser WITH PASSWORD 'somepassword' REPLICATION;
GRANT ALL PRIVILEGES ON DATABASE demodb TO demouser;
-- ALTER USER demouser WITH REPLICATION;Now exit pgAdmin and reconnect using the Postgres user demouser, then run the following script to create the schema, tables, and load sample data. https://github.com/umeshsf/publiccode/blob/main/postgres/setupdb.sql
At this stage, Postgres is running with sample data in demo database, with retail schema, and bunch of tables in retail schema. In, In Snowflake, it contains an empty database named retailcdc_db.
Create Flow Definition File for OpenFlow
To simplify the process, use my Streamlit App to create your own Flow Definition file that can be imported into OpenFlow. If you are not comfortable providing all the information, then download the Streamlit app and all the files from the following GitHub link and run it by yourself in your laptop. You will need python environment.
https://github.com/umeshsf/publiccode/tree/main/postgres
cd {dirctory_where_file_downloaded}
conda activate {myenv}
pip install -r requirements.txt
streamlit run app.py
--Input all the value for your postgres instance, and snowflake database
-- then click on download file
-- this file we will use in OpenflowPostgressCDC in OpenFlow
Next, create a new runtime in OpenFlow. If you need help, refer to the guide here. Be sure to include the external access integration (OPENFLOW_POSTGRES_EAI) created in the earlier steps. This option appears at the bottom of the Create Runtime screen, so don’t miss it.
Once the runtime is ready, click it to open a blank canvas. From the top toolbar, select the Process Group icon (the fourth icon) and drag it onto the canvas. When the Create Process Group dialog opens, click the red circle shown below and upload the Flow Definition file you created earlier with Streamlit.
After you upload the file, a Process Group is created. Click into it, and you’ll see another Process Group called PostgreSQL, as shown below.
Right-click the PostgreSQL process group and update the source settings by entering the demouser password we created earlier, as it wasn’t included in the file. You’ll also need to upload the Postgres JDBC driver — download the .jar file from here: https://jdbc.postgresql.org/download/
To wrap things up, follow these final steps to activate your data pipeline:
- Exit to the main canvas and right-click to enable all controller services.
- And then click Start to begin the CDC process.
Once active, your Postgres data will flow seamlessly into Snowflake. Now open your PgAdmin tool and start inserting data or updating existing records, those changes will be replicated to Snowflake. From Snowflake, you can immediately put your data to work across the Snowflake AI Data Cloud — whether you’re querying via SQL, building with Cortex Analyst, or powering Snowflake Intelligence and MCP agents.
Conclusion:
The walls between “transactional” and “analytical” data are falling. With Snowflake Postgres, your operational data is no longer trapped in a silo. It is part of the AI Data Cloud, governed by Snowflake Horizon, and ready to be used for real-time analytics and AI-driven insights without the need for complex movement.I love Snowflake Postgres because it allows you to perform operations using SQL commands, opening up many use cases where you can create and remove resources as needed. This article shows just how easy it is to replicate data from Postgres to Snowflake. An even simpler method is coming soon, where your data will show up in Snowflake automatically — stay tuned!
Happy Holidays!
Disclaimer: The opinions expressed in this post are my own and not necessarily those of my employer (Snowflake).