first commit

Really what you need to do here is figure out the size of batches to split the query into, given that you might have a remainder that is smaller than the maximum batch size.  Have you thought about using the modulus operator `%` to get this remainder?