Database speed improvements