First Ever Not First In Window

Counting entities encountered for the first time means taking MIN over the entity's whole history and asking whether that minimum lands inside the window — the natural version, which filters to the window and then groups, calls every entity new. Covers why the wrong query passes its first test, why the window belongs in HAVING rather than WHERE, what an unbounded scan needs from the index, and how a retention prune quietly redefines "ever". Use when a "new this period" figure tracks the distinct count exactly, when discovery rate is implausibly close to 1, or before writing any first-seen query.

maxrave-dev e431a62 6.7 KB Updated

File contents

maxrave-dev/kotlin-footguns/tree/main/skills/first-ever-not-first-in-window commit e431a62d66

Frequently asked questions

npx skillmds@latest add maxrave-dev/first-ever-not-first-in-window