PostgreSQL: Modern, Capable, Scalable, Extensible, and Fun
In this article, learn more about PostgreSQL, including details about licensing, installation, and more.
Join the DZone community and get the full member experience.Join For Free
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 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 a 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. It's just honest to goodness the fact that I’ve gone 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, it's not perfect, but man, the experience is very pleasing.
It's difficult to maintain a perception of fairness when you are challenging long-standing ideas and ideologies. Every relational database management system has great features, and in this post, I will talk about PostgreSQL and why you should consider it. Maybe you are already using SQL Server happily, and that is ok. What I ask is to have an open mind and see if PostgreSQL brings something to the table.
There are numerous posts available online, which talk in great detail 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 an 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 PostgreSQL?
First, Postgres is every bit capable as SQL Server and actually more feature-rich in some aspects. It's not only just a relational database, but it is also an object-relational database. No additional licensing, and it's ready to go by default. It has modern data types (e.g. Inet for storing IP-Addresses etc). JSON is a 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 the 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).
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 requirements. Microsoft does offer a 26-page licensing guide you can read, but that just black text on black background. Not only licensing, but the process of paying Microsoft and how much to pay is painful. It's 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 takes 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 want to just let development or the development process guide you in this decision. In other words, what is the easiest thing for you and your development team? If it was up to us developers, we would 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 manages a very big licensing cost. Here is what Jef Antwood has 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, which makes sense that the licensing fee might not be an issue for some businesses.
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 a 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 and 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 an amount for Postgres in terms of tools or hosting. Supporting and maintaining a system costs money no matter what we do. So careful analysis will be a good strategy. The main point is that there is always more than one solution.
I remember 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? The last time I tried, it was a 12-step process and was a little bit daunting. Download and installing PostgreSQL was comparatively very easy and didn’t require me to hop through various blog posts to figure out the installation.
I have used SQL Server a lot in the past, and 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. Until next time, happy coding!
Published at DZone with permission of Jawad Hasan Shani. See the original article here.
Opinions expressed by DZone contributors are their own.