顯示具有 Profiler 標籤的文章。 顯示所有文章
顯示具有 Profiler 標籤的文章。 顯示所有文章

2010年6月24日 星期四

SQL Profiler 分析(1)

上網查了一下資料
發現了這個TSQL的語法可以查Profiler的效能
所以貼上來


SELECT * into #Temp
FROM ::fn_trace_gettable('D:\CGW\SQL Profiler\testGameDB81_100603.trc', default) --檔案路徑及名稱

-- 追蹤所得的資料本來就在資料表內,直接透過T-SQL 分析
SELECT SUBSTRING(TextData, 1,330) AS '名稱',
COUNT(*) '數量',
AVG(Duration) AS '平均執行時間(ms)',
AVG(CPU) AS '平均CPU 時間(ms)',
AVG(Reads) AS '平均閱讀次數',
AVG(Writes) AS '平均寫入次數'
FROM #Temp
WHERE EventClass=12 -- 12 代表SQL:BatchCompleted 事件
GROUP BY SUBSTRING(TextData, 1,330)
ORDER BY SUM(Duration) DESC


出處:http://blog.xuite.net/tim0718/note/21899219

2010年6月3日 星期四

SQL Performance Profiler Application Name

由於最近在學SQL Proformance 的東西
所以稍為紀錄一下學習過的東西囉

首先是Profiler這個SQL Performance內建軟體
簡單說 它就是在紀錄DB幹了啥好事的軟體
就是將所有動作記錄下來
可是勒
在這個欄位!!!Application Name 總是在連接時候都空的
找了一下資料後 才知道連接字串要把這個加入才會顯示
就是

Data Source=(local);Initial Catalog=DB;Integrated Security=True
Data Source=(local);Initial Catalog=DB;Integrated Security=True;Application Name=AppName

這樣要做分析 就會比較好分析喔