Take a look at ->
https://ermanarslan.blogspot.com/2016/12/rdbmsgrid-upgrading-rac-database-and.html"GATHER_DICTIONARY_STATS" gathers statistics for dictionary schemas 'SYS', 'SYSTEM' and internal schemas of RDBMS components.
Oracle says: To decrease the amount of downtime incurred when collecting statistics, you can collect statistics prior to performing the actual database upgrade.
You can do it just before the upgrade, I mean during your upgrade, when you get application downtime. (if you feel the prod app will be affected by that)
However; if it is taking a lot of time (you already tested it on your TEST env right?), then you may start executing it before the upgrade (in the upgrade day for instance, not too early but still at a time before you get the app downtime)