{"id":2364,"date":"2012-11-20T09:19:47","date_gmt":"2012-11-20T09:19:47","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=2364"},"modified":"2012-11-20T09:19:47","modified_gmt":"2012-11-20T09:19:47","slug":"%e4%bc%b0%e7%ae%97%e6%af%8f%e5%a4%a9%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84%e6%9b%b4%e6%96%b0%e9%87%8f","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2012\/11\/20\/%e4%bc%b0%e7%ae%97%e6%af%8f%e5%a4%a9%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84%e6%9b%b4%e6%96%b0%e9%87%8f\/","title":{"rendered":"\u4f30\u7b97\u6bcf\u5929\u6570\u636e\u5e93\u7684\u66f4\u65b0\u91cf"},"content":{"rendered":"<pre class=\"brush:sql;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;\">\r\n--\u4f30\u7b97\u6bcf\u5929\u6570\u636e\u5e93\u7684\u66f4\u65b0\u91cf\r\n\r\nDECLARE @starttime DATETIME\r\nSELECT @starttime = sqlserver_start_time \r\nFROM sys.dm_os_sys_info --\u53d6\u670d\u52a1\u5668\u542f\u52a8\u65f6\u95f4\r\n\r\n--\u6309\u7d22\u5f15\u8868\u4e2d\u6700\u5927\u7684\u66f4\u65b0\u91cf\u6765\u4f30\u7b97\r\nSELECT name,user_updates,last_user_update, \u65e5\u5e73\u5747\r\nFROM (\r\n\tSELECT\r\n\ttbl.name,user_updates\r\n\t,ius.last_user_update,\r\n\tuser_updates\/(DATEDIFF(mi,@starttime,last_user_update)*1.0\/(24*60)) \u65e5\u5e73\u5747\r\n\t,ROW_NUMBER() OVER( PARTITION BY name ORDER BY user_updates DESC )n\r\n\tFROM\r\n\tsys.dm_db_index_usage_stats ius \r\n\tINNER JOIN sys.tables tbl ON tbl.OBJECT_ID = ius.OBJECT_ID\r\n\tWHERE  ius.user_updates !=0 AND ius.database_id = DB_ID()\r\n)m\r\nWHERE m.n = 1 \r\nORDER BY m.\u65e5\u5e73\u5747 DESC\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8211;\u4f30\u7b97\u6bcf\u5929\u6570\u636e\u5e93\u7684\u66f4\u65b0\u91cf DECLARE @starttime DATETIME SELECT @start [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-2364","post","type-post","status-publish","format-standard","hentry","category-sql-server"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/2364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=2364"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/2364\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=2364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=2364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=2364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}