Draft: Create a partial TestCase index to help Job Errors page performance
This index contains only TestCases that passed the metadata string comparison test. This eliminates the need to scan metadata every time the page is loaded.
However, this means that the index has to be updated every time the Job Errors query is changed.
In the commit 927b09f4 the string matching was changed from regex to LIKE. However, it looks like Django fails to emit proper SQL when creating the partial index with LIKE method. (it emits double %% percent signs) Reverting to regex might cause a slightly worse performance but having and index completely compesates that.
Also change the Job Errors page sorting. The previous
suite__job__id DESC sorting had to load all the entries to
memory before sorting because it was sorted on key in a different
table. New sorting uses the TestCase primary key in d
This MR combined with !2015 (merged) improves the time to load job errors page from 90 to 0.018 seconds. (x5000 performance)