optimizing query daily n inbound