I am working on REST API currently. The resource that the API returns is expected to be huge data from database (tens of millions of row in DB). Pagination is a must in order to avoid enormous memory consumption when writing the data to HTTP response.
How to make sure the data integrity when there is deletion/addition of rows in DB in between client requests?
For example:
page 1: [ John, Mary, Harry, David, Joe ]
page 2: [ Mike, Don, Alex ]
After client requested for page 1 and stored it locally in (file/memory), before asking for page 2, the data is changed to:
page 1: [ John, Mary, Harry, David, **Mike** ]
page 2: [ Don, Alex, **Terry** ]