Which pagination method breaks large result sets into pages by skipping a set number of records and can produce duplicates or skipped records if data changes during pagination?

Test your Systems Design Concepts knowledge with our comprehensive quiz. Utilize flashcards and multiple choice questions to enhance your study session. Prepare thoroughly with detailed explanations for each answer and ace your examination!

Multiple Choice

Which pagination method breaks large result sets into pages by skipping a set number of records and can produce duplicates or skipped records if data changes during pagination?

Explanation:
Offset-based pagination uses a fixed offset to skip a set number of records, then returns the next group as the page. This approach is simple to implement—you request, for example, 10 items starting at offset 0, then 10 items starting at offset 10, and so on. The reason it can produce duplicates or skipped records when data changes is that the offset relies on a stable ordering of the underlying data. If new rows are inserted or existing ones are deleted between requests, the relative positions of items shift. A simple illustration: start with A, B, C, D, E and a page size of 2. The first page returns A and B. If a new item X is inserted between A and B, the order becomes A, X, B, C, D, E. The next page using an offset of 2 would return B and C, so B—seen on the first page—appears again on the second page, creating a duplicate. Conversely, some items that were on the second page before might be skipped entirely due to the shift. Because of this behavior, offset-based pagination isn’t ideal for dynamic data. Other methods—such as cursor-based or keyset pagination—use a pointer to the last seen value (like a unique ID) to fetch the next page, which remains stable even if new rows are added or removed in between requests.

Offset-based pagination uses a fixed offset to skip a set number of records, then returns the next group as the page. This approach is simple to implement—you request, for example, 10 items starting at offset 0, then 10 items starting at offset 10, and so on.

The reason it can produce duplicates or skipped records when data changes is that the offset relies on a stable ordering of the underlying data. If new rows are inserted or existing ones are deleted between requests, the relative positions of items shift. A simple illustration: start with A, B, C, D, E and a page size of 2. The first page returns A and B. If a new item X is inserted between A and B, the order becomes A, X, B, C, D, E. The next page using an offset of 2 would return B and C, so B—seen on the first page—appears again on the second page, creating a duplicate. Conversely, some items that were on the second page before might be skipped entirely due to the shift.

Because of this behavior, offset-based pagination isn’t ideal for dynamic data. Other methods—such as cursor-based or keyset pagination—use a pointer to the last seen value (like a unique ID) to fetch the next page, which remains stable even if new rows are added or removed in between requests.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy