Code Room
Code reviewHardcr-g213
Subject Sql data accessLevel Senior–Staff~26 minCommon in Databases & SQL · Networking & APIs interviewsIndustries Software development, Technology

Question

Review this SQL-backed feed pagination (page is 1-based, page_size = 50). The query is regenerated per request; `$1` = feed_id, `$2` = page number from the client.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewsql
-- ordered by recency; an index exists on posts(feed_id, created)SELECT p.id,       p.body,       p.created,       u.handle AS authorFROM posts pJOIN users u ON u.id = p.author_idWHERE p.feed_id = $1  AND p.deleted_at IS NULLORDER BY p.created DESCLIMIT 50OFFSET ($2 - 1) * 50;
Run or narrate your approach, then ask the coach.