Share of Messenger Conversations Answered Within Five Minutes

Last updated: November 29, 2026

Quick Overview

Using a Messenger messages table, define a conversation as a message after at least six hours of thread silence, and write SQL for the daily share of conversations that get a reply from another participant within five minutes.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Onsite
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Using a Messenger messages table, define a conversation as a message after at least six hours of thread silence, and write SQL for the daily share of conversations that get a reply from another participant within five minutes.

Responsiveness is a core health signal for messaging products like Messenger and WhatsApp. This Meta-style SQL problem combines sessionization with LAG and a time-bounded self-join, and the interviewer checks the conversation definition, the 'other participant' condition, and boundary handling.

What the Interviewer Expects
  • Uses LAG within a thread to find conversation starts
  • Joins only replies from a different sender within the window
  • Keeps unanswered conversations with a LEFT JOIN
  • Breaks timestamp ties deterministically
  • Discusses group threads and cost of the range join
Key Topics to Cover
LAG
Sessionization
Self-join with time window
Response metrics
LEFT JOIN
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
  • How would you report median reply time instead of a 5-minute threshold?
  • How should group chats with many participants be handled?
  • How would you exclude automated business replies?
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

Table: messages(message_id, thread_id, sender_id, sent_at). Threads may be 1:1 or groups; for groups, a reply from any other member counts. A conversation starts with the first message in a thread, ...

Approach
  1. Use LAG(sent_at) per thread to get the previous message time. A start is where it is NULL or more than 6 hours earlier.
  2. For each start, LEFT JOIN messages in the same thread from a different s...

Submit Your Answer
Markdown supported