posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat(logs): enhance cursor pagination and time-slicing optimization

Open jonmcwest opened this issue 11 months ago • 0 comments

Problem

Cursor pagination was slow because:

  1. Time-slicing was skipped entirely for page 2+
  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.

jonmcwest avatar Dec 10 '25 14:12 jonmcwest