Kitware/CDash — pull request #5 by zackgalbreath (2014-10-30 18:04:26+00:00)
Title: Improve load time of index.php when there are lots of builds

Using CDash with subprojects can result in lots of builds. In our particular case, we had around 5,500 builds per day, and this number is only expected to go up. This large number of builds caused index.php?display=project to load very slowly (taking a minute or more). This PR improves the performance of index.php dramatically (now loading in a few seconds or less).

@jjomier There are a couple issues that I would appreciate your feedback on before we merge this PR.

1) In order to achieve this speedup, I had to remove the following clause from the large SQL query in index.php:
```AND gp.starttime<'$end_UTCDate' AND (gp.endtime>'$end_UTCDate' OR gp.endtime='1980-01-01 00:00:00')```
The problem here is that if a buildgroup has more than one entry in the buildgroupposition table, the current position might not be the first one that's returned. If this happens, one solution would be to manually remove the older entries from buildgroupposition. IMO, we should give up on the idea of maintaining old group positions, and consider moving this field into the buildgroup table (eliminating the need for the buildgroupposition table altogether).

2) Is the way that I added new indices to label2build satisfactory, or should I have used the AddTableIndex() function instead?