Skip to content
Preptima
hardDesignCase StudyMidSeniorStaff

Every message must survive the phone being wiped, and a user has 40,000 of them. Where do they live and how are they paged?

The server holds one row per message, partitioned by conversation and clustered by descending sequence so a page is a contiguous read, and clients page by keyset cursor rather than offset. Per-user state moves to a side table so the body stays shared, and if messages are end-to-end encrypted the wipe is a key-custody question, not a storage one.

6 min readUpdated 2026-08-15

Answer

Short answer

Messages that survive a wiped phone must live durably on the server, with the phone treated as a rebuildable cache. Store messages by conversation and sequence, page with keyset cursors instead of offsets, keep per-user state separately, and handle encryption keys explicitly because storage cannot restore messages if the only key was wiped.

Was this answer helpful?

Likely follow-ups

  • A group of five hundred people shares a conversation. What changes in the write path, and what stays the same?
  • A user deletes a message for themselves only. Where is that recorded, and what does a fresh device see?
  • How do you serve full-text search over forty thousand messages without scanning the partition?
  • Retention policy says delete anything older than two years. How do you enforce that without a nightly delete over the whole table?

Related questions