There is no point in indexing rows with common column values like "finished = 1", since those are the majority of the table. Only the exceptions ("finished = 0") are interesting. Having smaller tables should make updates/insertions faster.
YF3HTIPFEQKTVMGTU5JYB2VZDRHWFQJKRONR3EZJQBQXG3QOVUFQC 5L272QSCJRKQ33QFPYACFFAYREBPK2FMS7IKNQGKN2CHKOHXHZOAC LGNML7VJCQ4E53ZYRGL5BNK6KVTNQGPJKFIULSAGSTU6VK45INMAC PMNWRTGJ4GVSMSSAWSUD57B26PCRAHMZIQ5SIWJIK7A74ENKEQLAC 6QRHXIM3XHCDLSIIBEGETDV67V6LTV55QMHC64ZPBMLTAECM5N3QC N22GPKYTOLZLBGTGDATQDVZ4R5APZEAOIA7L32X4UXBH4XNI7MWAC E2TOU3L66CH5DA4XPATQM5YM63SFXX63V7SDOIGS4ND3GR7HQALAC 2QA4Y4G3VK3CGBMWET2LROJTZRFVR5G2Y6GXUCIOCGZB7YQ3L7FAC TFVGX4JSTPHVTYUITKXWW2RKV27IEL3UQYXJFNDBPIBUU3XTZSDAC RXVJFQ5AV3WME4HDVBPSRCALQTXROT4KQPOQVO6KTWTBNZIZZGPAC D5QIOJGPKQJIYBUCSC3MFJ3TXLPNZ2XMI37GXMFRVRFWWR2VMTFAC create index IndexBuildStepsOnBusy on BuildSteps(busy);create index IndexBuildStepsOnDrvpathTypeBusyStatus on BuildSteps(drvpath, type, busy, status);
create index IndexBuildStepsOnBusy on BuildSteps(busy) where busy = 1;create index IndexBuildStepsOnDrvPath on BuildSteps(drvpath);
create index IndexBuildsOnFinished on Builds(finished);create index IndexBuildsOnFinishedBusy on Builds(finished, busy);create index IndexBuildsOnIsCurrent on Builds(isCurrent);create index IndexBuildsOnJobsetIsCurrent on Builds(project, jobset, isCurrent);create index IndexBuildsOnJobIsCurrent on Builds(project, jobset, job, isCurrent);
create index IndexBuildsOnFinished on Builds(finished) where finished = 0;create index IndexBuildsOnFinishedBusy on Builds(finished, busy) where finished = 0;create index IndexBuildsOnIsCurrent on Builds(isCurrent) where isCurrent = 1;create index IndexBuildsOnJobsetIsCurrent on Builds(project, jobset, isCurrent) where isCurrent = 1;create index IndexBuildsOnJobIsCurrent on Builds(project, jobset, job, isCurrent) where isCurrent = 1;
drop index IndexBuildStepsOnBusy;drop index IndexBuildStepsOnDrvpathTypeBusyStatus;drop index IndexBuildsOnFinished;drop index IndexBuildsOnFinishedBusy;drop index IndexBuildsOnIsCurrent;drop index IndexBuildsOnJobsetIsCurrent;drop index IndexBuildsOnJobIsCurrent;drop index IndexBuildsOnKeep;create index IndexBuildStepsOnBusy on BuildSteps(busy) where busy = 1;create index IndexBuildStepsOnDrvPath on BuildSteps(drvpath);create index IndexBuildsOnFinished on Builds(finished) where finished = 0;create index IndexBuildsOnFinishedBusy on Builds(finished, busy) where finished = 0;create index IndexBuildsOnIsCurrent on Builds(isCurrent) where isCurrent = 1;create index IndexBuildsOnJobsetIsCurrent on Builds(project, jobset, isCurrent) where isCurrent = 1;create index IndexBuildsOnJobIsCurrent on Builds(project, jobset, job, isCurrent) where isCurrent = 1;create index IndexBuildsOnKeep on Builds(keep) where keep = 1;