Creates indexes to enhance searches in table .
Also activates logging on mysql to look at queries and try to correct if
possible.
Modifies code so that Indexes are really taken into account.

Tested full night without increasing CPU load.