One of the most powerful features of SonarQube is that it shows you not just your project health today, but how it has changed over time. It does that by selectively keeping data from previous analyses. It doesn't keep all previous analyses - that would bloat the database. Similarly, for the analyses it does keep, SonarQube doesn't keep all the data. Once a project snapshot moves from the the "Last analysis" (i.e. the most recent) to being part of the project's history, data below the project level is purged - again to keep from bloating the database.
Typically these aren't things you need to even think about; SonarQube just handles them for you. But occasionally you may need to remove a bad snapshot from a project's history or change the housekeeping algorithms.
Every snapshot with an event is ignored by the housekeeping algorithms, and retained indefinitely in the database. There are four types of events:
All events are indicated in the Timeline widget. Version events are used by the History Table widget.
As previously mentioned, when you run a new analysis of your project, some data that was previously available is cleaned out of the database. For example the source code of the previous analysis, measures at directory and file levels, and so on are automatically be removed at the end of a new analysis. Additional, some old analysis snapshots are also removed.
It is useful to analyze a project frequently to see how its quality evolves. It is also useful to be able to see the trends over weeks, months, years. But when you look back in time, you don't really need the same level of detail as you do for the project's current state. To save space and to improve overall performance, the Database Cleaner deletes some rows in the database. Here is its default configuration:
These settings can be changed at Settings > General Settings > General > Database Cleaner.
Occasionally, you may need to manually delete a project snapshot, whether because the wrong quality profile was used, or because there was a problem with analysis, and so on. Note that the most recent snapshot (labeled "Last snapshot") can never be deleted.
Deleting a snapshot is a 2-step process:
At project level, go to Configuration > History.
For every snapshot, it is possible to manually: