Fix some broken indices

[?]
Oct 28, 2020, 1:18 PM
762ZKDT3MIPKV547IMOZHL75XDUNCVGSYSSHRXDLL4DWQCP4GKBAC

Dependencies

  • [2] GUHKIKQR hydra.sql: add an index for slow queries in production
  • [3] P57OYJ4P Index builds on stop time
  • [4] APURLT2Q Revert "Apply IndexBuildsOnJobFinishedId to unfinished builds only"
  • [5] OT4YGU4Q Builds: index literally what latest-finished queries
  • [6] C5W3WZ3Y * Index the Builds table on drvPath to prevent a full table scan
  • [*] N22GPKYT * Put info about logs / build products in the DB.
  • [*] D5QIOJGP * Move everything up one directory.

Change contents

  • replacement in src/sql/hydra.sql at line 604
    [3.100][2.0:91](),[2.91][3.0:141](),[3.100][3.0:141]()
    create index IndexBuildsOnJobsetIdFinishedId on Builds(id DESC, finished, job, jobset_id);
    create index IndexFinishedSuccessfulBuilds on Builds(id DESC, buildstatus, finished, job, jobset_id) where buildstatus = 0 and finished = 1;
    [3.100]
    [3.0]
    create index IndexBuildsOnJobsetIdFinishedId on Builds(jobset_id, job, finished, id DESC);
    create index IndexFinishedSuccessfulBuilds on Builds(jobset_id, job, finished, buildstatus, id DESC) where buildstatus = 0 and finished = 1;
  • file addition: upgrade-68.sql (----------)
    [9.3004]
    drop index IndexBuildsOnJobsetIdFinishedId;
    create index IndexBuildsOnJobsetIdFinishedId on Builds(jobset_id, job, finished, id DESC);
    drop index IndexFinishedSuccessfulBuilds;
    create index IndexFinishedSuccessfulBuilds on Builds(jobset_id, job, finished, buildstatus, id DESC) where buildstatus = 0 and finished = 1;