PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Coinbase

Design query pagination for large datasets

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of pagination strategies, cursor/keyset design, SQL query formulation, consistency guarantees under concurrent writes, and indexing for very large datasets.

  • medium
  • Coinbase
  • System Design
  • Software Engineer

Design query pagination for large datasets

Company: Coinbase

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

## Scenario You are building an API that returns a **paginated list** of records from a very large dataset (millions+ rows). Clients can specify: - Filters (e.g., status, date range) - Sort order (e.g., `created_at desc`, possibly tie-breaking by `id`) - Page size (limit) Example endpoint: - `GET /items?status=OPEN&sort=created_at_desc&limit=50&cursor=...` ## Requirements 1. Support **fast pagination** for deep pages (e.g., user keeps scrolling). 2. Results should be **stable**: users should not see duplicates or missing items while paginating, even if new records are inserted concurrently. 3. Support common relational databases (e.g., Postgres/MySQL) and typical indexes. 4. Handle common edge cases: - Many records share the same `created_at` - Data can be inserted/updated/deleted while the user paginates - Clients may change filters/sort between requests ## Tasks 1. Propose a pagination strategy (e.g., offset-based, cursor/keyset-based, or hybrid) and explain the trade-offs. 2. Define the **cursor format** and what fields it must contain. 3. Provide example SQL queries for the first page and subsequent pages. 4. Discuss how you would ensure stability/consistency, and what guarantees you can realistically provide (e.g., “as of” snapshot vs best-effort). 5. Describe the indexing strategy and how it changes with different sort orders.

Quick Answer: This question evaluates a candidate's understanding of pagination strategies, cursor/keyset design, SQL query formulation, consistency guarantees under concurrent writes, and indexing for very large datasets.

Related Interview Questions

  • Design Crypto Order Routing - Coinbase (hard)
  • Design a crypto trading web frontend - Coinbase (hard)
  • Design a food delivery system - Coinbase (medium)
  • Design real-time crypto prices homepage - Coinbase (hard)
  • Design Frontend Architecture for Trading UI - Coinbase (hard)
Coinbase logo
Coinbase
Feb 11, 2026, 12:00 AM
Software Engineer
Onsite
System Design
18
0
Loading...

Scenario

You are building an API that returns a paginated list of records from a very large dataset (millions+ rows). Clients can specify:

  • Filters (e.g., status, date range)
  • Sort order (e.g., created_at desc , possibly tie-breaking by id )
  • Page size (limit)

Example endpoint:

  • GET /items?status=OPEN&sort=created_at_desc&limit=50&cursor=...

Requirements

  1. Support fast pagination for deep pages (e.g., user keeps scrolling).
  2. Results should be stable : users should not see duplicates or missing items while paginating, even if new records are inserted concurrently.
  3. Support common relational databases (e.g., Postgres/MySQL) and typical indexes.
  4. Handle common edge cases:
    • Many records share the same created_at
    • Data can be inserted/updated/deleted while the user paginates
    • Clients may change filters/sort between requests

Tasks

  1. Propose a pagination strategy (e.g., offset-based, cursor/keyset-based, or hybrid) and explain the trade-offs.
  2. Define the cursor format and what fields it must contain.
  3. Provide example SQL queries for the first page and subsequent pages.
  4. Discuss how you would ensure stability/consistency, and what guarantees you can realistically provide (e.g., “as of” snapshot vs best-effort).
  5. Describe the indexing strategy and how it changes with different sort orders.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Coinbase•More Software Engineer•Coinbase Software Engineer•Coinbase System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.