If you are targetting to move to 6.7 LTS and to install a commercial Edition, please read this documentation.
Before you start, backup your SonarQube Database. Upgrade problems are rare, but you'll want the backup if anything does happen.
Refreshing your database's statistics and rebuilding your database's indices are recommended once the technical upgrade is done (just before the very last step).
For PostgreSQL, that means executing
VACUUM FULL. According to the PostgreSQL documentation
In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table; they remain present until a VACUUM is done.
Check the documentation pages of the SCAN you use to see if upgrades are available.