Data size of postgres DB decreased after upgrading sonarqube from 6.1.1 to 8.9 LTS

we have a sonarqube(v6.1.1) running with backend postgres database(RDS AWS v9.6.x). we have 123 GB of data size in this version. we took snapshot of RDS from current postgres and created the new postgres with the snapshot taken, we see same 123 GB data replicated to new postgres, then started sonarqube version upgrade with the below upgrade path.

6.7.1 > 6.7.7 > 7.9 > 8.9 LTS

when I start sonar with v6.7.7 the data migration has gone fine and and the data size was also 123GB
when I start sonar with v7.9 the data migration has gone fine and I see slight decrease in data size it was 107GB
when I start sonar with v8.9 the data migration has gone fine and I see large drop in data size now the data size is 17GB.

is this the expected behaviour?

Our Sonarqube details:

  1. Running on EC2 as docker container
  2. Backend postgres RDS DB 9.6.22
  • But I could see all our projects migrated to new sonar and I can see them in sonar dashboard

Hey there.

It is possible that some database migrations would cause your database to shrink (for example: we since SonarQube v6.x we no longer store the history of file/directory measures).

And, for such dramatic drops, I can’t help but wonder if perhaps when upgarding you performed a VACUUM for the first time in a long while (it’s in the upgrade guide) which causes your database to finally toss out deleted data.