Hi All,
Need some help in query tuning. There is a query which is provided by app team. They says it gets timed out after 2 hours as they set query timeout = 2 hours. Now they reached out for help from DBA team.
We tried to run the query in Plan explorer to get the actual execution plan. The query is running over 9 hours but still doesn't finishes its execution. There is blocking involved. We have updated statistics with full scan. Still it runs forever .....
don't really know whats happening.
Status of the spid always showing "runnable". what does it mean?
When I open up the Windows task mgr and see the cpu utilization, it is 40-55% and not more than that which is normal.
From sql server configuration side, they are 12 logical cpu on the prod server but MAXDOP is set to 1. just wanted to mention this. Not sure how much it is related here in this context.We are running SQL Server 2012 sp4 Enterprise Edition.
I really don't understand whats the problem with the query can any help here.
dropbox link
https://www.dropbox.com/s/5ky0761iv6pmf36/QueryTuning.zip?dl=0
Collected below information so far.
- Query executing for more than 9 hours and still NOT YET finished !! - "Executing forever.PNG"
- sp_whoisactive output - "sp_WIA.PNG"
- Table and Index defintions - ddl.sql
- Query text - "src_qry.txt"
- Estimated Execution Plan ( collected using SQL Sentry Plan Explorer) -"EstimatedPlan.pesession"
- Table sizes and index fragmentation details "Tablesizes n Index Fragmentation details.PNG"
- When was stats got updated for those tables - "statistics update date.PNG"
- sp_configue settings -"sp_configure settings.PNG"
- cpu info - "cpu_info.PNG"
- memory info - "memory_info.PNG"
Thanks,
Sam