From a recently migrated Craft CMS 2 site, there are various entries in the Control Panel which take a very long time to load (sometimes over 30 seconds). This is the same in our production environment with debugging off, so it is not overhead from dev mode. Testing on the old Craft CMS 2 site with entries that exist in both, this is not happening.
Profiling with Yii Toolbar I can see that it's clearly showing rendering the matrix field in the Control Panel is taking up a sizable amount of the request. This is also consistent with testing other entries which do not feature this field and load much quicker. Removing this field is obviously not an option because it provides many matrix blocks for entry content.
The front end is fine and does not have issues loading entries which take a very long time to load in the Control Panel.
I cannot see any DB query that's causing such a long load time but any pointers on digging into this issue would be appreciated. Something is clearly hanging the render template call, but again this is limited to the Control Panel and not front end.
The site is running Craft CMS 3.7.46.