Getting Started with PostgreSQL
| November 17, 2021 | in
Writing software applications involves building many components. One of these components is the client, the piece of the application that the user interaction interacts with. Another component is the backend business logic, typically writing that in some server-side technology. The backend business logic enforces the required business rules. But another standard piece of application software is the persistence, or how we store the data is generated by the users. The most common place we store this data is some form of database. In the Microsoft ecosystem, we usually use Microsoft SQL Server. But many other database technologies work well. One of those is PostgreSQL.
When we consider PostgreSQL (instead of SQL Server), isn’t so much about one is better than the other. But there are differences between the two. And I feel like if you were already in the Microsoft ecosystem, there are some advantages just to stay within it. But a big reason to be looking at PostgreSQL from a Microsoft ecosystem perspective is the Marten library. Marten allows for the saving of documents into your PostgreSQL database, and this allows you to use your database as a NoSQL store. We will discuss Marten in a later blog post.
Why a use PostgreSQL database? Probably one of the biggest reasons is the difference in pricing. Since PostgreSQL is open source, costs are often lower than Microsoft SQL Server. If you have a solution that needs multiple databases, the savings can add up in a hurry.
How to get started? If you’re on Mac like me, I recommend downloading the Postgres app. This makes it really easy to get started. Just run the app, and you have a database. Stop the app, and no more database. It’s a lot like running it in Docker, but with less Docker. 🙂 If you are on Windows, there is an installer for PostgreSQL.
Once you have PostgreSQL, you can connect to it much like you would SQL Server. The connection string looks a little different.
Configuring PostgreSQL as an Identity Management store is easy too, and pretty much the same as you would for SQL Server.
PostgreSQL is a powerful database option, and it has a huge following. Heck, Rob Conery wrote a whole novel about using it.
Are you in the SQL Server Camp or PostgreSQL Camp? Feel free to reach out to me on Twitter (@chadmichel) to send me the reasons for your selection.