Solutionunvalidated

Simply turning off the monitoring (the SQL trace) on production decreased a prod script from 8 minutes to 40 seconds — If monitoring is still required (for auditing or other reasons). Outcome: there is a workaround provided by @gordthompson which uses OPENJSON.

b10e30f3-261d-4c83-91d8-e77edc9da22f

Simply turning off the monitoring (the SQL trace) on production decreased a prod script from 8 minutes to 40 seconds — If monitoring is still required (for auditing or other reasons). Outcome: there is a workaround provided by @gordthompson which uses OPENJSON.