{"id":6376,"date":"2019-03-11T08:14:53","date_gmt":"2019-03-11T08:14:53","guid":{"rendered":"https:\/\/ittutorial.org\/?p=6376"},"modified":"2019-11-28T07:01:23","modified_gmt":"2019-11-28T07:01:23","slug":"sql-server-wait-events-3","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/sql-server-wait-events-3\/","title":{"rendered":"SQL Server Wait Events -3"},"content":{"rendered":"<p>Hi,<\/p>\n<p>You should find that which of wait events are in the SQL Server database.<\/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=\"xgnMRIyHJk\"><p><a href=\"https:\/\/ittutorial.org\/sql-server-wait-events-2\/\">SQL Server Wait Events -2<\/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 -2&#8221; &#8212; IT Tutorial\" src=\"https:\/\/ittutorial.org\/sql-server-wait-events-2\/embed\/#?secret=uRgDK8Sl9s#?secret=xgnMRIyHJk\" data-secret=\"xgnMRIyHJk\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/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>You can find wait events of database with following query.<\/p>\n<p>&nbsp;<\/p>\n<pre>SELECT getdate() as 'Run_Time' --script running time\r\n    , wait_type --wait type\r\n    ,waiting_tasks_count\r\n\t, CAST(wait_time_ms \/ 1000. AS DECIMAL(12, 2)) AS wait_time_s --saniye cinsinden bekleme zaman\u00fd\r\n\t, CAST(100. * wait_time_ms \/ SUM(wait_time_ms) OVER() AS DECIMAL(12, 2)) AS pct --toplam beklemeye oran\u00fd\r\nFROM sys.dm_os_wait_stats\r\nWHERE wait_type NOT IN ('BROKER_TASK_STOP','Total','SLEEP','BROKER_EVENTHANDLER','BROKER_RECEIVE_WAITFOR',\r\n      'BROKER_TRANSMITTER','CHECKPOINT_QUEUE','CHKPT,CLR_AUTO_EVENT','CLR_MANUAL_EVENT','KSOURCE_WAKEUP','LAZYWRITER_SLEEP',\r\n      'LOGMGR_QUEUE','ONDEMAND_TASK_QUEUE','REQUEST_FOR_DEADLOCK_SEARCH','RESOURCE_QUEUE','SERVER_IDLE_CHECK',\r\n      'SLEEP_BPOOL_FLUSH','SLEEP_DBSTARTUP','SLEEP_DCOMSTARTUP','SLEEP_MSDBSTARTUP','SLEEP_SYSTEMTASK','SLEEP_TASK',\r\n      'SLEEP_TEMPDBSTARTUP','SNI_HTTP_ACCEPT','SQLTRACE_BUFFER_FLUSH','TRACEWRITE','WAIT_FOR_RESULTS','WAITFOR_TASKSHUTDOWN',\r\n       'XE_DISPATCHER_WAIT','XE_TIMER_EVENT','WAITFOR')\r\nORDER BY 4 DESC<\/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.<\/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-6376","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\/6376","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=6376"}],"version-history":[{"count":4,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6376\/revisions"}],"predecessor-version":[{"id":12955,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6376\/revisions\/12955"}],"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=6376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=6376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=6376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}