Skip to content

Instantly share code, notes, and snippets.

@gabidavila
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabidavila/2cfdf7950c667f5263d1 to your computer and use it in GitHub Desktop.
Save gabidavila/2cfdf7950c667f5263d1 to your computer and use it in GitHub Desktop.

Switchers guide to Postgres - Intro

As developers one item on our long ToDo list is to bring stuff from somewhere, do the every day CRUD operation and make that stuff store more and more data.

Differently from the majority people who started programming in PHP with MySQL, that was not my first RDBMS system. Believe it or not, it was Firebird!

The project I worked on was a web interface to the already running Delphi ERP system. So I learned to do things a little differently and was very lost when I started to use MySQL, let's just say that Firebird was more strict than the popular database.

After that I had the oportunity to experiement other database flavors. Postgres, Microsoft SQL Server and Oracle too.

In this post series I want to show you how to migrate your current application to PostgreSQL and why to start using it if you are about to create a new project.

I use an ORM, for me it doesn't make a difference

One thing you need to keep in mind is that ORM are only prepared to do your CRUD operations, it maps your models and builds your query for you so you can maintain an abstract layer into your application. Queries that are complex because of heavy business logic may not have good performance if built by an ORM as a direct SELECT would.

As most ORM have some kind of Active Record basis, we usually have the 1 model = 1 table system, but in reality things are more complicated than that, see Chris Fidao post to get a better understanding about it.

I dare to say that PHP + MySQL is some kind of sanctity between PHP developers. I think people are wrong to dismiss or automatically accept a technology because they use an abstraction layer, because every database system has a set of tools that can be used for your application advantage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment