Which of the following is a common drawback of using offset-based pagination in large datasets?
Think about what happens if new items are added or removed while paginating.
Offset pagination uses page numbers and offsets, so if data changes between requests, the same item might appear on different pages or be skipped.
You are designing a social media feed that updates frequently. Which pagination pattern is best to ensure users see a consistent and smooth scrolling experience?
Consider how to handle new posts appearing while the user scrolls.
Cursor pagination uses a stable cursor like a timestamp or unique ID, which helps maintain consistency even if new posts are added.
When scaling a system with millions of records, which pagination method is more efficient to reduce database load and why?
Think about how the database uses indexes to find rows.
Cursor pagination uses indexed columns (like IDs or timestamps) to fetch the next set of rows without scanning large offsets, reducing load.
Which statement best describes a tradeoff when choosing between cursor and offset pagination?
Consider implementation complexity and user experience consistency.
Offset pagination is easy to implement but can show inconsistent results if data changes. Cursor pagination is more complex but provides stable views.
A database table has 10 million records. If each page shows 100 records, what is the maximum page number a user can request using offset pagination?
Divide total records by records per page.
10,000,000 records / 100 records per page = 100,000 pages maximum.