Optimize requests to db