← Coinbase Interview Insights

Coinbase·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026

Summary

Coinbase system design round, one big question about pagination that branched into like six different sub-problems. Felt like I was holding on for dear life by the end.

Questions Asked (1)

Q1

Design a query pagination system. Walk through offset-based vs cursor/keyset pagination, how you handle consistency when rows are inserted or deleted mid-session, deep-page performance, total count queries, ties in sort order, and pagination across multiple shards.

System DesignTechnical Trade-offsData Modeling
Author's notes

This started as a pretty normal pagination question and I thought I had it, then they kept pulling on threads.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., consistency needs, scale, read/write patterns) and then compare offset-based and cursor-based pagination, highlighting trade-offs in performance, consistency, and complexity. Walk through each sub-topic systematically, proposing solutions like keyset pagination with tie-breakers, snapshot isolation for consistency, and shard-aware cursors, while acknowledging limitations and potential optimizations.

Pro tip: Emphasize that cursor-based pagination is generally preferred for large, dynamic datasets due to stable performance and consistency, but offset-based can be acceptable for small or static data; always discuss how to handle edge cases like ties and deletions to show depth.

1. Clarify Requirements and Constraints

Ask about data volume, read/write ratio, consistency requirements, latency SLAs, and whether the system is sharded. This shapes the choice between offset and cursor pagination.

2. Compare Offset vs Cursor Pagination

Explain offset-based pagination (LIMIT/OFFSET) is simple but suffers from deep-page performance and inconsistency; cursor-based (keyset) uses a unique, ordered key to fetch next page efficiently and consistently.

3. Address Consistency and Deep-Page Performance

For consistency, propose snapshot isolation or cursor-based pagination that avoids duplicates/skips. For deep pages, highlight offset's O(n) scan vs cursor's O(log n) index seek.

4. Handle Total Count, Ties, and Sharding

Discuss approximate counts or separate count queries; use tie-breaker columns (e.g., ID) in sort order; for sharding, merge sorted streams from shards using a global cursor or scatter-gather with pagination.

5. Summarize Trade-offs and Recommendations

Conclude with when to use each approach, potential optimizations (e.g., caching counts, composite cursors), and how to scale across shards.

Key Points to Mention

  • Offset-based pagination: simple but O(offset) performance and inconsistency with inserts/deletes.
  • Cursor/keyset pagination: stable performance and consistency, but requires a unique, sequential key and cannot jump to arbitrary pages.
  • Consistency handling: snapshot isolation, cursor encoding of last seen values, or using a stable sort key to avoid duplicates/skips.
  • Deep-page performance: offset scans and discards rows; cursor uses index seek.
  • Total count queries: expensive on large datasets; consider approximate counts or separate count service.
  • Ties in sort order: include a tie-breaker (e.g., primary key) in the cursor to ensure deterministic ordering.
  • Sharding: merge sorted results from shards using a global cursor or scatter-gather with per-shard cursors and a merge step.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.