Day-Thirty Retention by Friends Added in the First Ten Days
Last updated: November 29, 2026
Quick Overview
For new Facebook users, count friendships formed in their first 10 days (accepted requests in either direction), bucket the count (0, 1 to 2, 3 to 6, 7 or more), and report Day-30 window retention for each bucket by signup month.
Meta
November 29, 20260
0
0 solved
For new Facebook users, count friendships formed in their first 10 days (accepted requests in either direction), bucket the count (0, 1 to 2, 3 to 6, 7 or more), and report Day-30 window retention for each bucket by signup month.
Facebook's early growth team famously focused on getting new users to a handful of friends quickly, and interviewers still use this activation question. It checks handling a symmetric relationship table, a time-bounded count relative to signup, LEFT JOINs that keep zero-friend users, and bucketing.
What the Interviewer Expects
- Count friendships where the user appears on either side
- Bound the count to days 0 through 9 after signup
- Keep users with zero friendships
- Use a window around day 30 for retention
- Discuss the limits of an activation threshold read from correlational data
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you find the threshold that best separates retained from churned users?
- What if most early friendships come from contact import?
- How would you validate a threshold causally?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
users(user_id, signup_date), friendships(user_a, user_b, accepted_ts) stored once per pair in arbitrary order, daily_active(user_id, ds). Day 30 window is days 28 through 34. Only mature users a...
Approach
Unfold friendships into one row per endpoint with UNION ALL. Count edges per new user within the 10-day window via LEFT JOIN. Add the retention flag with EXISTS and bucket....