Add a better total events count

Postgresql don't handle counting on a hugh table that well.
So we add a extra table to keep track of all events.
The counting is made by a trigger that adds total rows
on the events table by counting on inserts/deletes.

Read more about it: http://www.varlena.com/GeneralBits/49.php