I have a SOQL for loop wherein the query sometimes returns more rows than the limit of 50,000. The code block executes once per record returned by the query, and in that code block is an if statement that breaks the loop if a certain value reaches 20,000. The log shows that the loop was broken during the 10,000th iteration, as I expected, but it also said that the query returned 50,001 rows.
I thought SOQL for loops query in batches of 200. Shouldn't it not have returned the rest of the rows yet? Shouldn't it only count the 10,000 (or 10,200 at the worst) against my limit?