After migrating from SQL Server 2014 to SQL Server 2016, we have been experiencing query timeouts using MERGE-statements on some datasets.
Tested versions: WORKING: SQL Server 2014 Enterprise (64-bit) (12.0.5532.0) TIMEOUTS: SQL Server 2016 Enterprise (64-bit) (13.0.4001.0) and SQL Server 2016 Enterprise (64-bit) (13.0.1601.5)
Code to reproduce the timeout error: enter link description here