zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    用互不相同的fib数列的数分解任意整数。
    2015 初赛TG 错题解析
    【模板】判断二叉查找树
    【初赛】完善程序题解题技巧 && 近六年PJ完善程序真题解析
    [NOIP 2012普及组 No.2] 寻宝
    [NOIP 2012普及组 No.1] 质因数分解
    [NOIP 2013普及组 No.4] 车站分级
    [NOIP 2013普及组 No.3] 小朋友的数字
    [NOIP 2013普及组 No.2] 表达式求值
    [NOIP 2013普及组 No.1] 计数问题
  • 原文地址:https://www.cnblogs.com/researcher/p/6152916.html
Copyright © 2011-2022 走看看