v5.35 release includes significant changes to the backend database architecture in support of Shared Channels and Collapsed Reply Threads. These architecture changes have noticeably affected the performance of the migration process in some cases for the v5.35 release (May 16, 2021). Factors affecting performance include size, type, and version of the database. On average, the expected migration time is under five minutes with a moderate to significant spike in database CPU usage. Performance of follow-on upgrades will return to normal. More details on the performance impact of the migration and possible mitigation strategies are provided here.
Please see the important upgrade notes document for more: Important Upgrade Notes — Mattermost 5.35 documentation.