The project DAO `selectProjectUuidsAssociatedToDefaultQualityProfileByLanguage`
SQL query implies scanning through many rows of the `live_measures` table . This
takes several minutes to execute in some setups (Postgres 13, 200M rows in the
table), making SonarQube upgrades painfully slow (this request is executed for
each update of a bundled quality profile).
A similar query can be achieved by joining the `projects` table, with a drastic
improvement to the execution plan. The results are not the same though: this new
version only returns uuids of actual projects, whereas the original one also
returns uuids of other components (not existing in the projects table). But this
is actually an improvement too: the only call sites for this DAO method (in
`QualityProfileChangeEventServiceImpl`) uses the results as an input for the
`ProjectDAO.selectByUuids()` method, which only looks at the `projects` table.