Upgrading postgres version 9.5.16 to 9.6.18 version getting CPU hits 100%

PS: related discussion Sonarqube analysis taking 1+hr after DB upgrade to postgres10