Azure – How to optimize the SQL query which uses cte, group by and running for 20+ hours?
I have a query which first performs joins inside cte and then based on cte join with other table and perform group by with some aggregations and get the top 15 records. WITH join_table as ( SELECT pl.yearmonth, pl.pdid, pl.OrderId,…