Confluent Cloud operations needs to determine which API keys were alive during a requested interval. An API key is considered alive during the half-open interval from an ACTIVE event until the next lifecycle event, including an open-ended interval when no later event exists.
Write a PostgreSQL query that returns every registered key with at least one active interval overlapping the requested range.
Requirements
- Use
LEAD to determine when each lifecycle interval ends.
- Treat intervals as half-open,
[start, end), so an activation exactly at the range end does not qualify.
- Return the overlapping portion of each active interval, including multiple qualifying intervals for one key.
- Order results by
key_id and the beginning of the overlap.