If flow designer was used prior to upgrade to Madrid an index may be missing on sys_flow_context.execution_id. This missing index will cause performance issues with queries as the size of the number of flow executions grows.
Steps to Reproduce
1. Start with a London instance.
2. Define a flow and execute it several times to ensure there are multiple rows in the sys_flow_context table.
3. Upgrade the instance from London to Madrid.
4. Look at the indexes present on sys_flow_context and observe that there is no index on execution_id.
* The unique index could not be created due to the existing rows in sys_flow_context. The issue will not occur on a instance with 0 or 1 rows in sys_flow_context (zbooted instances for example)
Manually create an index on sys_flow_context.execution_id.
Related Problem: PRB1420648