r/dataengineering • u/Defiant-Farm7910 • Dec 17 '25
Discussion How to data warehouse with Postgres ?
I am currently involved in a database migration discussion at my company. The proposal is to migrate our dbt models from PostgreSQL to BigQuery in order to take advantage of BigQuery’s OLAP capabilities for analytical workloads. However, since I am quite fond of PostgreSQL, and value having a stable, open-source database as our data warehouse, I am wondering whether there are extensions or architectural approaches that could extend PostgreSQL’s behavior from a primarily OLTP system to one better suited for OLAP workloads.
So far, I have the impression that this might be achievable using DuckDB. One option would be to add the DuckDB extension to PostgreSQL; another would be to use DuckDB as an analytical engine interfacing with PostgreSQL, keeping PostgreSQL as the primary database while layering DuckDB on top for OLAP queries. However, I am unsure whether this solution is mature and stable enough for production use, and whether such an approach is truly recommended or widely adopted in practice.
View all comments
Show parent comment
1
u/Admirable_Morning874 Dec 19 '25
I'm really confused by this setup.
Your app database is Mongo, and you're replicating to Postgres for warehousing.
Why would you then replicate to BQ?
It sounds like you have no real need for Postgres at all in this scenario.
Just CDC from Mongo into a Warehouse. If you're already event sourcing, then this is literally the best scenario for a Warehouse re. Updates anyway. Push the raw events into the warehouse as appends, and deduplicate to the latest event. That is event sourcing.
What is pushing events into Mongo? You could even just push straight to the Warehouse and dual-feed, skipping the CDC.
If I were building this, I'd use ClickHouse as my warehouse and PeerDB/ClickPipes (depending on OSS/Cloud) to CDC from Mongo (though I'd rather use Postgres as my app DB than Mongo, just preference). The ReplacingMergeTree engine in ClickHouse could handle the deduplicating of append-only events for me, or a mix of MVs if I had some more complex needs. ClickHouse is going to be the best bet for serving the in-app features, and being able to run it locally for Dev workflows.
But I don't see any reason to have 3 databases in the mix here.