Maintain Entry Numbers with Incremental Loads and Historical Backfills

Read the full interview experience this question came from →

Quick Overview

Design incremental per-context entry numbering with idempotent state, contiguous-gap backfills, and correct handling of interleaved late events.

Maintain Entry Numbers with Incremental Loads and Historical Backfills

Role: Analytics Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

# Maintain Entry Numbers with Incremental Loads and Historical Backfills A table contains `entry_uuid`, `context_uuid`, `visitor_id`, `created_at`, and `platform`. Every entry needs a one-based position within its context, ordered by `(created_at, entry_uuid)`. The table is loaded incrementally each day. Explain how to maintain these entry numbers without scanning all history for every daily load. Then explain how to repair numbering if a contiguous historical interval was missing even though later entries have already been processed. Distinguish that case from late data interleaved throughout the existing timeline. This is a pipeline-design discussion rather than a request to write a query. ### What a Strong Answer Covers - Per-context state and the assumptions under which appending local row numbers is correct. - An idempotent, atomic relationship between inserted entries and updated state. - A historical backfill based on state before the gap and shifts to affected later entries. - A correct fallback for interleaved late arrivals, tie ordering, and affected-context scope. ```hint Find the insertion point Today’s maximum is a count after the already-processed suffix, not the number of entries before a historical gap. ``` ### Follow-up Questions - What goes wrong if a daily load is retried after entries were written but state was not updated? - What if a late entry has the same created_at as an existing entry but sorts earlier by entry_uuid?

Overview: Design incremental per-context entry numbering with idempotent state, contiguous-gap backfills, and correct handling of interleaved late events.

Read the full Analytics Engineer interview experience this question came from

|Home/System Design
Sep 12, 2026
mediumAnalytics EngineerTechnical ScreenSystem Design
0
0

Maintain Entry Numbers with Incremental Loads and Historical Backfills

A table contains entry_uuid, context_uuid, visitor_id, created_at, and platform. Every entry needs a one-based position within its context, ordered by (created_at, entry_uuid). The table is loaded incrementally each day.

Explain how to maintain these entry numbers without scanning all history for every daily load. Then explain how to repair numbering if a contiguous historical interval was missing even though later entries have already been processed. Distinguish that case from late data interleaved throughout the existing timeline. This is a pipeline-design discussion rather than a request to write a query.

What a Strong Answer Covers Guidance

  • Per-context state and the assumptions under which appending local row numbers is correct.
  • An idempotent, atomic relationship between inserted entries and updated state.
  • A historical backfill based on state before the gap and shifts to affected later entries.
  • A correct fallback for interleaved late arrivals, tie ordering, and affected-context scope.

Follow-up Questions Guidance

  • What goes wrong if a daily load is retried after entries were written but state was not updated?
  • What if a late entry has the same created_at as an existing entry but sorts earlier by entry_uuid?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...