is there a reason you can't do this with the product ids instead? seems like (1) there will be fewer of them so the query should be faster, and (2) you don't have to worry about other case types