Improved some db queries.

Speedups (on live server):

* add
	- 3.5~4 times
* eventmgr
	- 35~45 times
Merge pull request #106 from Prillan/sql-optimizations

Improved some db queries.