SQL vs NoSQL
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 5 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Build-up · 5 steps

    Store one follow four ways

    Two users, Asha (u1) and Ravi (u2), two orders Asha placed, and one follow. Watch each model arrange the same facts.

    Step 1 of 5

    Relational, three tables

    Each fact is stored once, and an order row holds a user_id value, not a pointer. “Who follows Ravi?” is an index lookup on follows plus a join.

    3 interview moments

    You’re the candidate

    The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

    1. Deep dive 1 of 3

      Interviewer

      “Food-delivery orders. Today every read is “a customer’s orders, newest first”. Do you build a query-first wide-column table or use PostgreSQL?”

      Your move. Pick an approach:

    2. Deep dive 2 of 3

      Interviewer

      “Assume 200,000 riders online, each pinging every 4 seconds. Customers need free riders within 3 km. Where do the positions live?”

      Your move. Pick an approach:

    3. Deep dive 3 of 3

      Interviewer

      “Every product category has different attributes and is read as one record. A teammate says, “Let’s use MongoDB for everything.” Your call?”

      Your move. Pick an approach:

    Build-up · 6 steps

    Climb the decision ladder, slice by slice

    Start relational, then ask each question for one slice of data. Each yes points at the store that fits that slice.

    Step 1 of 6

    Start relational

    Choose one slice of data at a time, core records first. The system of record starts in one relational database, PostgreSQL or MySQL.