{"id":6368,"date":"2019-03-11T07:55:31","date_gmt":"2019-03-11T07:55:31","guid":{"rendered":"https:\/\/ittutorial.org\/?p=6368"},"modified":"2019-11-28T07:01:56","modified_gmt":"2019-11-28T07:01:56","slug":"sql-server-wait-events-2","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/sql-server-wait-events-2\/","title":{"rendered":"SQL Server Wait Events -2"},"content":{"rendered":"<p>Hi,<\/p>\n<p>You should find that which of wait events are in the SQL Server database and status of currently waiting tasks.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6277\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/03\/sql_server_wait_types_in_DPA_494x150.jpg\" alt=\"\" width=\"494\" height=\"150\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/03\/sql_server_wait_types_in_DPA_494x150.jpg 494w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/03\/sql_server_wait_types_in_DPA_494x150-300x91.jpg 300w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/p>\n<p><!--more--><\/p>\n\n<p>&nbsp;<\/p>\n<p>Read previous article with following link<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"c78tRVEZp9\"><p><a href=\"https:\/\/ittutorial.org\/sql-server-wait-events\/\">SQL Server Wait Events -1<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;SQL Server Wait Events -1&#8221; &#8212; IT Tutorial\" src=\"https:\/\/ittutorial.org\/sql-server-wait-events\/embed\/#?secret=u9fsgcTCdv#?secret=c78tRVEZp9\" data-secret=\"c78tRVEZp9\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>To solve slowness of SQL Server database, you should find which wait events exists in the database.<\/p>\n<p>&nbsp;<\/p>\n<p>You can get list and status of currently waiting tasks with following script.<\/p>\n<p>&nbsp;<\/p>\n<pre>select wt.session_id, wt.exec_context_id, wt.wait_duration_ms, wt.wait_type, wt.blocking_session_id, wt.resource_address, wt.resource_description, s.program_name, st.text, sp.query_plan, s.cpu_time cpu_time_ms, s.memory_usage*8 memory_usage_kb\r\nfrom sys.dm_os_waiting_tasks wt\r\n\tjoin sys.dm_exec_sessions s on s.session_id=wt.session_id\r\n\tjoin sys.dm_exec_requests r on r.session_id=s.session_id\r\n\touter apply sys.dm_exec_sql_text(r.sql_handle) st\r\n\touter apply sys.dm_exec_query_plan(r.plan_handle) sp\r\nwhere s.is_user_process=1\r\norder by wt.session_id, wt.exec_context_id;<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><span style=\"color: #ff0000;\">Do you want to learn Microsoft SQL Server DBA Tutorials for Beginners, then read the following articles.<\/span><\/h4>\n<p><a href=\"https:\/\/ittutorial.org\/sql-server-tutorials-microsoft-database-for-beginners\/\">https:\/\/ittutorial.org\/sql-server-tutorials-microsoft-database-for-beginners\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, You should find that which of wait events are in the SQL Server database and status of currently waiting tasks.<\/p>\n","protected":false},"author":1,"featured_media":6277,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3828,2227,3827],"tags":[1028,1031,1600,1610,2231,2264,2263,2275,2232,2273,2237,2236,2267,2270,2269,2230,2229,2274,2265,2266],"class_list":["post-6368","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-sql-scripts","category-sql-server-2","category-sql-server-dba-scripts","tag-mehmet-deveci","tag-mehmet-salih-deveci","tag-sql-server-2012","tag-sql-server-2014","tag-sql-server-2019","tag-sql-server-active-sessions","tag-sql-server-active-sessions-and-status","tag-sql-server-database-wait-events","tag-sql-server-inventory-script","tag-sql-server-optimizer","tag-sql-server-select-inventory","tag-sql-server-select-machine-name","tag-sql-server-sessions","tag-sql-server-statistics","tag-sql-server-stats","tag-sql-server-useful-query","tag-sql-server-useful-script","tag-sql-server-wait-events","tag-sql-server-whoisactive","tag-whoisactive"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/03\/sql_server_wait_types_in_DPA_494x150.jpg","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=6368"}],"version-history":[{"count":3,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6368\/revisions"}],"predecessor-version":[{"id":12958,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6368\/revisions\/12958"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/6277"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=6368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=6368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=6368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}