Small optimization to rating queries