I have a huge table with rows in the millions. I need to process all of them in a program.
I am interested in only one column which is studentId
. How do I write a query to load up 2000 of those items and then feed it to the program to process and then get the next batch of 2000 and so on?
The problem is how do I keep track of which items I have already processed, the list isn't sorted.
EDIT: The process I need to do is this: I have a table in the form of [studentId, name, DepartmentId]
The number of students here could easily be 30 to 40 million. The various departments that they belong to typically could be in order of thousands...So DepartmentId's could be in the range of 5000 to 6000. The rows could be interspersed. Now I need to get all students belonging to a specific department, and process them in a program. I cannot load a million student ids at once, so i need to do some sort of batching. Thanks.