Why Put PostgreSQL in Azure

I’ve had people come up to me and say “PostgreSQL is open source and therefore license free. Why on earth would I put PostgreSQL in Azure?”

Honestly, I think that’s a very fair question. The shortest possible answer is, of course, you don’t have to. You can host your own PostgreSQL instances on local hardware, or build out VMs in Azure and put PostgreSQL out there, some other VM host, or maybe in Kubernetes containers, I mean, yeah, you have tons of options. So why PostgreSQL in Azure, and specifically, I mean the Platform as a Service offering? Let’s talk about it.

PostgreSQL in Azure

Let’s assume for a moment that you’re PostgreSQL expert (I’m not, but I do play one on TV). You know exactly how to set up servers to get optimal performance and protection. You’ve set up disaster recovery multiple times and you’re good at it. You’re also extremely comfortable with the high availability aspects of PostgreSQL. You, may, in fact, not benefit from PostgreSQL in Azure. However, you still might. Let’s get into what those of us who are not experts at PostgreSQL see in Azure.

First, and this is huge for me, while I’m learning PostgreSQL internals, from how to create a table, which indexes to pick, and how to configure the vacuum process, I’m not spending lots of time learning about servers and server settings. There’s just so much to know, and you must draw a line somewhere. So, by putting my PostgreSQL in Azure, the very first benefit I see, is that I don’t have to create, adequately provision, and appropriately set up, and maintain a server. For me, and many people in my situation, this is a win. Also add in people who need to manage their data in PostgreSQL, but have near zero technical abilities.

Next, and again, a very big point, is security. Just as I’m not spending lots of time on learning about servers, I’m primarily interested in database security, not all the server set ups. As the peerless PostgreSQL expert, you’re managing your own security. However, for lots of other people, they’re like me and freely admit they don’t know it well enough, or, they don’t know it well enough and do a poor job on security. Frankly, Microsoft is extremely security conscious. By default, when you create your PostgreSQL database in Azure, it’s extremely secure. It would require actions from you to make it unsecure.

I will learn about PostgreSQL high availability at some point. But I haven’t yet. That’s OK, PostgreSQL in Azure has some really great high availability features through the Flexible Server. For the PostgreSQL experts out there, you can probably do all this on your own. However, some of use either can’t, or don’t want to, maintain the HA solution, but still need one. That’s where Azure shines.

The very first thing I learned to do in PostgreSQL was take a backup and run a restore. Why? Because I’m a paranoid control freak, what we used to call a DBA (I hear the cool kids are taking on the title of data or database engineer now, no more administrators cause that’s a dirty word). PostgreSQL in Azure has a great backup story. Point in time recovery up to five minutes is possible. Retention can be between 7 days (the default) and up to 35 days.

There’s more. Azure has a tone of machine learning and AI stuff going on behind the scenes. One of them includes the ability to tune your PostgreSQL databases. And speaking of performance, PostgreSQL doesn’t have anything as cool as the SQL Server Query Store, so Microsoft built one. That’s right, you get Query Store when you put PostgreSQL in Azure. This includes wait statistics if you want them. Very cool stuff.


So, why would you put PostgreSQL in Azure? It really comes down to choosing to pay for things you either can’t, or won’t build on your own. Good high availability and disaster recovery require a lot of time and effort, as well as real hardware and software outlays. You’re spending money on it one way or another. Same thing goes for security, tuning, monitoring. If you have the ability and time, you can build all this on your own. However, placing your PostgreSQL in Azure means that you get a whole slew of protections for your databases and data, much of it, by default, out of the box.

100% granted, this is not a solution for everyone. However, it absolutely is a solution for many. It’s a question of evaluating all the offerings, understanding the associated costs, and making an informed decision. It’s entirely possible that putting PostgreSQL in Azure is the right call for your situation.

2 thoughts on “Why Put PostgreSQL in Azure

  • Elijah

    Unless you’re already locked into Azure, I’d say you’d be better off with a fully managed platform on another cloud like AWS Aurora Postgres. Azure is great of your stack is tight to Microsoft products like SQL Server, but I wouldn’t consider them to have the best Postgres offering.

Please let me know what you think about this article or any questions:

This site uses Akismet to reduce spam. Learn how your comment data is processed.