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

  • 相关阅读:
    stl_heap.h
    stl_tree.h
    stl_set.h
    stl_multiset.h
    ant:如何用ant将web project打包成war包
    将java project打包成jar包,web project 打包成war包的几种演示
    windows的各种扩展名详解
    图解教你如何使用ANT打包java程序
    使用apache mail发送邮件错误解决办法
    java虚拟机的运行原理
  • 原文地址:https://www.cnblogs.com/researcher/p/6152916.html
Copyright © 2011-2022 走看看