Cohort Retention After Merging Duplicate Facebook Accounts

Last updated: November 29, 2026

Quick Overview

Some people create a second Facebook account after losing access to the first, and an account_links table maps each secondary account to a canonical person. Recompute Day-7 retention per signup week at the person level and compare it with the account-level numbers.

Meta
Data Manipulation (SQL/Python)
Data Engineer
Meta
November 29, 2026
Data Engineer
Onsite
Data Manipulation (SQL/Python)
Hard

0

0

0 solved


Some people create a second Facebook account after losing access to the first, and an account_links table maps each secondary account to a canonical person. Recompute Day-7 retention per signup week at the person level and compare it with the account-level numbers.

Meta reports people-level metrics, not raw account counts, so a strong data engineer must know how to collapse duplicate accounts before computing retention. The onsite probes mapping logic, choosing a person's true signup date, and explaining why account-level retention is biased downward when users abandon one account and start another.

What the Interviewer Expects
  • Map every account to a canonical person id with COALESCE
  • Define person signup as the earliest signup across linked accounts
  • Union activity across accounts at the person level
  • Compute both metrics side by side for comparison
  • Explain the direction of the bias
Key Topics to Cover
entity resolution
canonical ids
person-level metrics
COALESCE mapping
metric bias
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • What if links are chained (A to B, B to C)?
  • How would you handle links discovered weeks after the fact, and backfills?
  • Which other metrics change when you dedupe people, for example DAU and new-user counts?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

accounts(account_id, signup_date), account_links(account_id, person_id) covering only accounts known to be duplicates (one level, already flattened), and daily_active(account_id, ds). Unlinked a...

Approach

Create acct_person with COALESCE(link.person_id, account_id). Person signup date is MIN(signup_date) across that person's accounts. Person activity is the distinct (person, ds) union. Then compu...


Submit Your Answer
Markdown supported