Adding indexes and speeding up doorlog query