Merge query in SQL server suddenly going into suspended

I have a SQL merge query that has been working fine in production without any issues for last 3+ months but suddenly, it is getting stuck.

I also checked with infrastructure team to confirm no changes were made to the existing DB server.

After some research, I ran this query below to get more details and it seems the merge got suspended with wait_type CXPACKET or CXCONSUMER.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>SELECT wt.session_id,
ot.task_state,
wt.wait_type,
wt.wait_duration_ms,
wt.blocking_session_id,
wt.resource_description,
--es.[host_name],
es.[program_name]
FROM sys.dm_os_waiting_tasks wt
INNER JOIN sys.dm_os_tasks ot ON ot.task_address = wt.waiting_task_address
INNER JOIN sys.dm_exec_sessions es ON es.session_id = wt.session_id
WHERE es.is_user_process = 1
and es.session_id = 84
and wait_type != 'CXCONSUMER'
</code>
<code>SELECT wt.session_id, ot.task_state, wt.wait_type, wt.wait_duration_ms, wt.blocking_session_id, wt.resource_description, --es.[host_name], es.[program_name] FROM sys.dm_os_waiting_tasks wt INNER JOIN sys.dm_os_tasks ot ON ot.task_address = wt.waiting_task_address INNER JOIN sys.dm_exec_sessions es ON es.session_id = wt.session_id WHERE es.is_user_process = 1 and es.session_id = 84 and wait_type != 'CXCONSUMER' </code>
SELECT  wt.session_id, 
    ot.task_state, 
    wt.wait_type, 
    wt.wait_duration_ms, 
    wt.blocking_session_id, 
    wt.resource_description, 
    --es.[host_name], 
    es.[program_name] 
FROM  sys.dm_os_waiting_tasks  wt  
INNER  JOIN sys.dm_os_tasks ot ON ot.task_address = wt.waiting_task_address 
INNER JOIN sys.dm_exec_sessions es ON es.session_id = wt.session_id 
WHERE es.is_user_process =  1
and es.session_id = 84
and wait_type != 'CXCONSUMER'
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>| session_id | task_state | wait_type | wait_duration_ms | blocking_session_id | resource_description | program_name |
|------------|------------|-----------|------------------|---------------------|----------------------|--------------|
| 84 | SUSPENDED | CXPACKET | 616 | 84 | exchangeEvent id=Pipe223d33ce580 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=5 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
| 84 | SUSPENDED | CXPACKET | 4129 | 84 | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=4 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
| 84 | SUSPENDED | CXPACKET | 839 | 84 | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=1 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
| 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84 | SUSPENDED | CXPACKET | 837 | 84 | exchangeEvent id=Pipe223d33ce180 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=2 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
| 84 | SUSPENDED | CXPACKET | 4128 | 84 | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=3 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
</code>
<code>| session_id | task_state | wait_type | wait_duration_ms | blocking_session_id | resource_description | program_name | |------------|------------|-----------|------------------|---------------------|----------------------|--------------| | 84 | SUSPENDED | CXPACKET | 616 | 84 | exchangeEvent id=Pipe223d33ce580 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=5 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python | | 84 | SUSPENDED | CXPACKET | 4129 | 84 | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=4 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python | | 84 | SUSPENDED | CXPACKET | 839 | 84 | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=1 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python | | 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python | | 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python | | 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python | | 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python | | 84 | SUSPENDED | CXPACKET | 11701531 | 84 | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python | | 84 | SUSPENDED | CXPACKET | 837 | 84 | exchangeEvent id=Pipe223d33ce180 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=2 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python | | 84 | SUSPENDED | CXPACKET | 4128 | 84 | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=3 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python | </code>
| session_id | task_state | wait_type | wait_duration_ms | blocking_session_id | resource_description | program_name |
|------------|------------|-----------|------------------|---------------------|----------------------|--------------|
| 84         | SUSPENDED  | CXPACKET  | 616              | 84                  | exchangeEvent id=Pipe223d33ce580 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=5 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
| 84         | SUSPENDED  | CXPACKET  | 4129             | 84                  | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=4 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
| 84         | SUSPENDED  | CXPACKET  | 839              | 84                  | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=1 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
| 84         | SUSPENDED  | CXPACKET  | 11701531         | 84                  | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84         | SUSPENDED  | CXPACKET  | 11701531         | 84                  | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84         | SUSPENDED  | CXPACKET  | 11701531         | 84                  | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84         | SUSPENDED  | CXPACKET  | 11701531         | 84                  | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84         | SUSPENDED  | CXPACKET  | 11701531         | 84                  | exchangeEvent id=Port20e1b04a200 WaitType=e_waitPortOpen waiterType=Coordinator nodeId=5 tid=0 ownerActivity=notYetOpened waiterActivity=waitForAllOwnersToOpen | Python |
| 84         | SUSPENDED  | CXPACKET  | 837              | 84                  | exchangeEvent id=Pipe223d33ce180 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=2 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |
| 84         | SUSPENDED  | CXPACKET  | 4128             | 84                  | exchangeEvent id=Pipe223d33ce280 WaitType=e_waitPipeNewRow waiterType=Producer nodeId=20 tid=3 ownerActivity=receivedData waiterActivity=tryToSendData merging=false spilling=false waitingToClose=false | Python |

Note that I filtered out CXCONSUMER wait types because I read that CXPACKET should be the main focus. I read up on the resource description and still unclear what it all means.

I’m trying to troubleshoot why it would suddenly start getting suspended and stuck for hours when before, the merge would only take 5-10 mins.

Can anyone please advise me on what the issue is and what steps I should take to fix?

I didn’t include my merge query as it’s typical insert, updates and deletes but let me know if I should include in post. Thank you.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật