api icon indicating copy to clipboard operation
api copied to clipboard

Chore: refactor PR histogram bucket generation query

Open jpmcb opened this issue 10 months ago • 0 comments

The PR time_bucket query to timescale is not performant:

Screenshot 2024-03-29 at 7 48 02 AM

this is a screenshot from some insights on timescale we can see and the medium time is way too slow. Which is surprising since it's using a hypertable and should be reporting faster results. There may be outliers but if I had to guess, it's because we build a partition table to then build the time series from in the genPrHistogram function:

https://github.com/open-sauced/api/blob/5f9897c1024747820387c744f3dd0abfdb9b704f/src/timescale/pull_request_github_events.service.ts#L498-L504

Regardless, this needs a second look.

jpmcb avatar Mar 29 '24 13:03 jpmcb