Add some more indexes to tables to improve db queries

Not sure if this can go into OC6, but i ran into this

@karlitschek @DeepDiver1975