posthog
posthog copied to clipboard
feat(logs): enhance cursor pagination and time-slicing optimization
Problem
Cursor pagination was slow because:
- Time-slicing was skipped entirely for page 2+
- No time_bucket bound meant ClickHouse couldn't use the primary key efficiently
Changes
- Narrow date range to cursor timestamp when paginating (enables time-slicing)
- Add time_bucket bound for better primary key pruning
How did you test this code?
EXPLAIN indexes = 1 confirms time_bucket is now in the PrimaryKey condition.
👉 Stay up-to-date with PostHog coding conventions for a smoother review.