Postgres is a really powerful database with a lot of features, One of the most important features which is very rarely found in other databases is “Table inheritance”

Table inheritance is very similar to class inheritance of OOP.In Table inheritance you have a parent table which is inherited by another table with extra columns in it.

By default the pg gem doesnt support table inheritance.

In the current project that I am working on, the business logic required the user to have template using which he could create items.This is where table inheritance shines.It allowed me to create the template model which contained all the generic attributes for the item.So everytime I would update the template the relevant model for the template would also be updated.
Continue reading



Databases are awesome, they are these blackboxes where data is stored and retrieved at really fast rate.Postgresql is one really fast open source database.

Usually when you want to speed up read speed on your database you usually create indexes on the relevant column.But recently I came to this realization that having more indexes increases the time per insert.

Here is the unscientific benchmark I ranContinue reading