Video summary

Data Modeling in System Design Interviews w/ Meta Staff Engineer

Main summary

Key takeaways

Educational

Summary

Evan explains how to build a practical data model during a software system design interview. The goal is not to produce an exhaustive data-engineering schema, but to show how the system’s entities, relationships, and queries can be supported by an appropriate database design.

Data modeling usually happens in two parts of the interview:

  1. Core entities: Identify the system’s main nouns, such as users, posts, and likes.
  2. High-level design: As you explain how APIs meet requirements, specify the necessary fields, keys, relationships, constraints, indexes, and—if scale requires it—sharding.

The design should be guided by three factors established earlier in the interview:

  • Data volume: How much data must the system store, and will it fit on one database node?
  • Access patterns: What queries do the APIs need to support? This is usually the most important factor.
  • Consistency requirements: Does the data require strong consistency, or can it tolerate eventual consistency?

Database Options

Evan recommends using a relational database such as PostgreSQL by default in interviews, unless you have strong experience with another option or the problem clearly calls for one. He cautions against choosing an exotic database without a specific reason.

  • Relational databases: Store entities in tables and connect them with keys. They support relationships and complex queries well, making them a strong general-purpose interview choice.
  • Document databases: Store flexible, JSON-like documents. Embedding related information can make some reads convenient, but is often motivated by weaker join support. Their schema flexibility is less compelling in an interview with narrowly agreed requirements.
  • Key-value stores: Fetch values by an exact key, like a large hash map. They are fast but offer limited querying, so data may need to be duplicated. They are often useful as caches alongside a primary database—for example, to store a user’s prepared feed.
  • Wide-column databases: Organize data into column families, allowing rows to have different columns. They can suit high-write-volume workloads such as time-series data, event logging, IoT data, or analytics, especially when older data is rarely updated.
  • Graph databases: Represent data as nodes and edges. Evan advises against choosing one merely because a problem involves social relationships or recommendations; a relational database may still be sufficient.

Data-Modeling Methodology

When modeling a system in an interview, Evan recommends the following steps:

  1. Choose the database.

    • Use the database type that fits the requirements and your experience.
    • If unsure, start with a relational database such as PostgreSQL.
  2. Identify entities and required fields.

    • Begin with the core entities identified earlier.
    • Add only the fields needed to satisfy the agreed functional requirements; avoid over-modeling.
  3. Define keys and relationships.

    • A primary key uniquely identifies each record in a table.
    • A foreign key points to a primary key in another table and helps enforce referential integrity.
    • Be explicit about keys in the interview. Rather than focusing on memorizing “one-to-many” or “many-to-many” terminology, show the foreign-key relationships clearly.
    • Add constraints when useful, such as requiring a column to be non-null or an email address to be unique.
  4. Start normalized.

    • Normalization stores each piece of information in one place, reducing duplication and the risk of inconsistent updates.
    • Denormalization deliberately duplicates data, usually to improve read performance, but can make updates harder to keep consistent.
    • Begin with a normalized model. Denormalize only when there is a specific performance need that indexing or other approaches cannot address. A cache can hold a denormalized copy when faster reads are worth some eventual inconsistency.
  5. Add indexes based on API queries.

    • An index helps the database find records without scanning every row, but indexes should be chosen deliberately.
    • Work backward from each API endpoint: identify the query it requires, then index the columns used to find or sort the relevant records.
    • Examples include indexing user_id to retrieve a user’s posts, post_id to retrieve a post’s comments, or created_at to sort by creation time.
  6. Consider sharding only when necessary.

    • Shard when the data is too large for a single database node.
    • Choose a shard or partition key based on the system’s main access patterns, aiming to keep related data together and avoid expensive cross-shard queries.
    • For example, posts and their comments could be sharded by post_id so that a post and its comments are colocated.

Main Lesson

The model should evolve alongside the system design: identify entities early, then refine the schema in the high-level design as you explain how APIs access data. Make choices based on data volume, access patterns, and consistency needs, and keep the model focused on what the requirements actually demand.

Speakers and Sources Featured

  • Speaker: Evan, who introduces himself as a former Meta staff engineer and Hello Interview co-founder.
  • Sources, products, and examples mentioned: Hello Interview’s delivery framework and guided-practice tool; PostgreSQL, MongoDB, Firestore, Redis, DynamoDB, and MySQL; Instagram-style examples involving users, posts, likes, and comments; and an online-auction example.

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video