When I talk about Azure Cosmos DB, I am usually talking about one of the APIs in the NoSQL realm. I’ve got a graph database talk that’s making its rounds – next up at .NET Conf 2022. For the Festive Tech Calendar this year, I will be showing their document database by using Azure Cosmos DB for MongoDB. Those are topics for another day. However, today, I want to tell you about Azure Cosmos DB for PostgreSQL.
Coming from a relational data background and having my mind put Azure Cosmos DB on the NoSQL side, my mind melted down when I first heard about Azure Cosmos DB for PostgreSQL. It kept going “But… Azure Cosmos DB… but Postgres…. but NoSQL… but SQL…” and then finally … 💥.
I had worked a bit with Postgres long ago, so I knew I was back in the relational realm. However, I suspected that there was a twist if Azure Cosmos DB was involved. When I think about Azure Cosmos DB and data, I think about scale – large amounts of data, horizontal scaling, and partitioning. Sure enough, Azure Cosmos DB for PostgreSQL allows for horizontal scaling of Postgres data with the help of an open source extension known as Citus.
This is SQL at scale. If you are coming into this with a general understanding of SQL but aren’t sure how this changes things in data modeling, I recommend checking out this Microsoft Learn module on modeling data for Azure Cosmos DB for PostgreSQL. The scenario in the module starts off with a relational intent and talks through the considerations when distributing data. This is another great resource for data modeling with Azure Cosmos DB for PostgreSQL: How to do data modeling for distributed Postgres in Azure Cosmos DB – Events | Microsoft Learn
You may be wondering… When would I choose Azure Cosmos DB for PostgreSQL over PostgreSQL? This is a managed platform, meaning you do not have to worry about the hardware or operating system level updates. Azure takes care of that for you. When you have large amounts of data (such as 100+ GBs of data), then you need to think about growth and on a platform that is meant to support it. When you’re getting beyond the limits of a single node, the scaling offered by Azure Cosmos DB for PostgreSQL makes sense. The cases made in this article by Claire Giordano on the Microsoft Community Hub really apply: When to use Hyperscale (Citus) to scale out Postgres – Microsoft Community Hub
If you want to learn more about Azure Cosmos DB for PostgreSQL, check out the following resources:
- Azure Cosmos DB for PostgreSQL learning path on Microsoft Learn
- Azure Cosmos DB: Liftoff – a post Ignite event that showcases everything Azure Cosmos DB for PostgreSQL
- Citus Con: An Event for Postgres (2022) – great way to learn more about the Postgres + Citus reakn