PostgreSQL

Postgres: Modern, Capable, Scalable, Extensible and Fun.

A bona fide slam dunk in my opinion, proper like Hallelujah. Now, do me a favor here, okay, and just allow me to get a little bit excited here, because I’ve lived through the crappy days and I think I deserve the chance to go a little bit OTT. Postgres is something genuinely architected to serve the purpose of database system. Now look, that probably did sound a bit fanboyish, and I totally excuse you if you are thinking I had stock in the company or something, which for the record I don’t. Its just honest to goodness the fact that I’ve went through the bad crappy days before and the contrast between then and now , well we all know the feeling, life is great again. Don’t get me wrong, right, its not perfect, but man the experience is very pleasing.

Its difficult to maintain a perception of fairness when you are challenging the long standing ideas and ideologies. Every relation database management system has great features and in this post, I will talk about PostgreSQL and why you should consider it. May be you are already using SQL server happily and that is ok, what I ask, is to have an open mind, and see if PostgresSQL brings something to table.

There are numerous posts available online, which will talk in great details about the technical comparisons, if you are interested in knowing those. However, I would like to share my experience with you regarding PostgreSQL and how easy it is to work with it.

Before using PostgreSQL, I was using SQL Server for most of my projects. Sometimes it was pre-decided by the IT department or CTO of the company I was working with, but most of the time, I never did pay much attention to some alternative anyway.

In the .NET world there is one only database solution for the most part and that’s SQL Server, which is fine. It is an amazingly capable database. Why should we care about PostgresSQL?

For first bit, Postgres is every bit capable as SQL server and actually more feature-rich in some aspects. Its not only just a relation database, it is an object relational database. No additional licensing and its ready to go by default. It has modern data types (e.g. Inet for storing IP-Addresses etc). JSON is first-class citizen, full-text indexes and it is very extensible.

Talking about extensibility, You can run chromo’s V8 engine, directly inside the database. It allows table inheritance, replications and also has document storage right inside relational system. I also read that you can also run npm inside postgres (not sure why you want to do that, but that’s interesting).

Licensing

Postgres is free.

Simply saying postgres is free and we should use it, is not a good argument. You need to be educated in all aspects of your licensing and what your commitments are later on.

SQL Server: Try to figure out compliance requirement. Microsoft does offer 26 page licensing guide you can read, but that just black text on black background. Not only licensing, but process of paying Microsoft and how much to pay is painful. Its not only about paying, making sure that we are in compliance and to figure out that, we have to pave through marketing documentations and licensing gobbledygook. That’s really just pain.

Its really simple, just to go with postgres.

It take a lot of time and consideration with licensing and where you want to be in 1-year, 3-year or 5-years. Ultimately, you don’t wanna just let development or development process guide you in this decision. In other words what the easiest thing for you and your development team. If it was up to us, developers, we choose the simplest tool-set and ask our bosses to just write the cheque.

Stack Overflow uses SQL Server

Stack Overflow uses Sql server and also manage a very big licensing cost. Here is what Jef Antwood have said about their decision:

We chose the Microsoft stack because we knew it intimately, and we all had years of development experience under our belts. We were also very much enamored of the ASP.NET MVC style of building websites, and IIS7. The .NET framework is quite fast and mature by now, with a nice 64-bit top to bottom toolchain supporting it. In short, we love our stack!

He also said the following and which make sense that licensing fee might not be an issue for some business.

Basically, it’s a gamble that some startups will transform into successful businesses in a few years, businesses that don’t care when they have to spend less than 1% of their income on software licensing fees.

Also, read what then CEO of stack overflow Joel Spolsky said on the similar topic.

So, choosing sql server is a valid option, but you should also have a good reason for it like we saw from the posts above. Sql server is fast, optimized and removing it might not be always the best option.

PostgreSQL also costs money

Well, nothing is free. At some point you will pay amount for postgres in terms of tools or hosting. Supporting and maintaining a system cost money, no matter what we do. So careful analysis will be a good strategy. Main point is that there is always more than one solution.

Installation

I remembered, back when I asked once our IT department to get oracle installed on my computer. They smiled, and yes that was right response. I don’t know if you had this experience but installing oracle was not easy.

Have you tried installing SQL Express? last time I tried, it was a 12 steps process and which was a little bit daunting. Download and installing PostgreSQL was comparatively very easy and didn’t require me to hoop through various blog posts to figure out the installation.

Summary

I have used SQL Server a lot in the past, I liked it but I think I like PostgreSQL a bit more. If you also have a possibility then I will suggest that you also give it a try and I am positive that you will not only like it but will be more productive as well. If you use Entity Framework as an ORM, you are covered. EF supports is very good and you will be still able to use LINQ for your data access layer. If you have some comments and questions, feel free to ask. Till next time, Happy Coding.

References