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 ran

Here are the results are we run the benchmark script.

Result without index

ruby bench.rb  0.19s user 0.15s system 12% cpu 2.696 total

Result with the index

ruby bench.rb  0.22s user 0.18s system 11% cpu 3.448 total