Bird
0
0

Why does keyset pagination generally perform better than offset pagination on large datasets?

hard📝 Conceptual Q10 of 15
Rest API - Pagination Patterns
Why does keyset pagination generally perform better than offset pagination on large datasets?
ABecause it avoids scanning and counting skipped rows
BBecause it caches all pages in memory
CBecause it uses random access to jump pages
DBecause it preloads all data before querying
Step-by-Step Solution
Solution:
  1. Step 1: Understand offset pagination cost

    Offset pagination requires scanning and counting rows before the offset, which slows queries as offset grows.
  2. Step 2: Identify keyset pagination advantage

    Keyset pagination uses a cursor to directly fetch next rows without scanning skipped rows, improving speed.
  3. Final Answer:

    Because it avoids scanning and counting skipped rows -> Option A
  4. Quick Check:

    Performance gain reason = B [OK]
Quick Trick: Keyset skips scanning skipped rows, boosting speed [OK]
Common Mistakes:
  • Thinking keyset caches all pages
  • Assuming random access is used
  • Believing data is preloaded

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes