Big optimization in image queries