How to resolve the truncate/drop/delete/join hang issue in ADW

Posted Researcher

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了How to resolve the truncate/drop/delete/join hang issue in ADW相关的知识,希望对你有一定的参考价值。

In some case, we found that when we execute the sql commands like truncate table, drop table, delete all records in table, join 2 tables, it will take very very long time, and the execution is still in progress, no any result returned.

Probably it is caused by the sql connection to the table is in using by other sessions, so the solution is just need terminate those sessions by below sql script:

kill ‘SID295302‘

 

How to view all running sessions, and then find out the session id? Just need execute belows:

select top 200
(case when requests.status = ‘Completed‘ then 100
when progress.total_steps = 0 then 0
else 100 * progress.completed_steps / progress.total_steps end) as progress_percent,
requests.status,
requests.request_id,
sessions.login_name,
requests.start_time,
requests.end_time,
requests.total_elapsed_time,
requests.command,
errors.details,
requests.session_id,
(case when requests.resource_class is NULL then ‘N/A‘
else requests.resource_class end) as resource_class,
(case when resource_waits.concurrency_slots_used is NULL then ‘N/A‘
else cast(resource_waits.concurrency_slots_used as varchar(10)) end) as concurrency_slots_used

from sys.dm_pdw_exec_requests AS requests

join sys.dm_pdw_exec_sessions AS sessions
on (requests.session_id = sessions.session_id)
left join sys.dm_pdw_errors AS errors
on (requests.error_id = errors.error_id)
left join sys.dm_pdw_resource_waits AS resource_waits
on (requests.resource_class = resource_waits.resource_class)
outer apply (
select count (steps.request_id) as total_steps,
sum (case when steps.status = ‘Complete‘ then 1 else 0 end ) as completed_steps
from sys.dm_pdw_request_steps steps where steps.request_id = requests.request_id
) progress

where requests.start_time >= DATEADD(hour, -24, GETDATE()) and requests.status = ‘Running‘

ORDER BY requests.total_elapsed_time DESC, requests.start_time DESC

以上是关于How to resolve the truncate/drop/delete/join hang issue in ADW的主要内容,如果未能解决你的问题,请参考以下文章

How to resolve unassigned shards in Elasticsearch——写得非常好

How to resolve emulator cannot be launched issue by command line

How to resolve CSRF protection error while adding service through Ambari api

how spring resolves a request

How to Pronounce the Months of the Year

[转]How to Clean the Global Assembly Cache