Optimize users query