問(wèn)題描述
有沒(méi)有辦法在 T-SQL 中捕獲 STATISTICS IO
和 TIME
以登錄到表中?
Is there a way to capture STATISTICS IO
and TIME
within T-SQL, for logging into a table?
推薦答案
排序.
查詢(xún)統(tǒng)計(jì) DMV 捕獲與 SET STATISTICS TIME
給出的統(tǒng)計(jì)相同的統(tǒng)計(jì):sys.dm_exec_query_stats
.
The same statistics as those given by SET STATISTICS TIME
are captured by the Query Statistics DMV: sys.dm_exec_query_stats
.
DMV 可以從 T-SQL 中查詢(xún),就像普通視圖一樣.
DMVs can be queried from T-SQL, just like normal views.
然而,SET STATISTICS IO
僅作為每次執(zhí)行的聚合值 (last_logical_reads, last_physical_read) 捕獲,沒(méi)有 SET STATISTICS IO
給出的每個(gè)行集的差異化.
However, the SET STATISTICS IO
are only captured as aggregate values (last_logical_reads, last_physical_read) per execution, without the differentiation per-rowset given by SET STATISTICS IO
.
總體而言,DMV 的作用與 SET STATISTICS IO
相同.
Overall though, the DMVs can serve the same purpose as SET STATISTICS IO
.
這篇關(guān)于將 SQL STATISTICS TIME 和 IO 捕獲到表中的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!