I have the same problem but the primary key in my case is a column with the datatype char(255). This means that the comparison operators =< and > cant be used.
Also I would like a more general solution that starts by checking the total number of records and then reads them in to a collection in chunks of lets say 500 records in each.
I tried to do that by filtering the original data source an get the next 500 records where the Id is not already in my collection but neither the "not"-function nor the "in" operator can be delegated to the sql data source so I'm out of luck.
I'm not allowed to create a view in the database, otherwise I could do that and add an index column using row_number to filter on.