There is one specific query that has been executed on MS SQL 2014 for long time. The query is running on AG secondary RO replica. The query execution time on MSSQL 2014 is about 5 seconds. After migration to MSSQL 2019 the same query is running about 5 minutes.
We found by trying out the different compatibility modes we can use SQL 2014, 2016, and 2017 modes and get fast results. Only in SQL 2019 does it slow down. Also we found that running the query alone runs quickly in any mode.
There is only problem with SQL 2019.