title: What is the most efficient way to search WooCommerce database for products by unique ID and check if product exists or not?
body: <p>Suppose you work with a 20,000 product database and you need to check if a product with each unique ID exists in the database or not. Rather than loading 20,000 products in PHP memory, what is another way to check? </p>
  
  <p>Can you load the 20,000 products in batches of 1000 products and check without having the memory explode?</p>
  
  <p>In other words, how can I get the first 5000 products out of 20,000, then load the next 5,000, and then the next?</p>
  
  <p>Is there a way to batch?</p>