Draft: TestJob: Add time indexes from most recent to oldest (+56% performance)
By default Django would create an ascending index.
For time field this would mean from the oldest time to most recent time.
However, most of the time LAVA would sort the jobs from most recent jobs to the oldests jobs. Having incorrect direction index hurts the performance.
This commit makes submit time index descending and also adds the
start_time and end_time descending indexes which helps the pages
like /scheduler/reports
.
Benchmarks of scheduler/alljobs
: (look at the IndexBackwardsScan before vs IndexScan after)
Before - 140.476 ms https://explain.depesz.com/s/81wD#html
After - 89.716 ms https://explain.depesz.com/s/lvCF#html
A 56% improvement.
This MR relies on !1950 and conflicts with !1953. (once one is merged the other needs a rebase)