Collections:
Join sys.allocation_units with fn_virtualfilestats()
How to join the sys.allocation_units system view with the fn_virtualfilestats() system function view?
✍: FYIcenter.com
 If you want to watch the I/O statistics of physical files related to 
a give table, you need to join sys.allocation_units system view with fn_virtualfilestats()
as shown below:
If you want to watch the I/O statistics of physical files related to 
a give table, you need to join sys.allocation_units system view with fn_virtualfilestats()
as shown below:
-- fyi_get_io_stats_by_table
-- Copyright (c) FYIcenter.com 
select t.name, p.partition_id, p.rows, a.type_desc, 
   a.data_space_id, a.data_pages, f.file_id, 
   s.NumberReads, s.BytesRead, s.NumberWrites, s.BytesWritten
   from sys.objects t, sys.partitions p, sys.allocation_units a, 
      sys.database_files f, fn_virtualfilestats(DB_ID(),NULL) s
   where t.name = 'ORDER'
      and t.object_id = p.object_id 
      and p.hobt_id = a.container_id
      and a.data_space_id = f.data_space_id
      and f.file_id = s.fileid
   order by p.partition_id
NAME   PARTITION_ID  ROWS  DATA_SPACE_ID  DATA_PAGES  FILE_ID  NUMBERREADS  BYTESREAD  ...
ORDER  721467753      140  1              4           1        4156         44335872   ...
ORDER  721468408      140  1              2           1        4156         44335872   ...
ORDER  721469064      140  1              1           1        4156         44335872   ...
As you can see, this ORDER table has 3 partitions in a single physical file.
⇒ I/O Tests on INSERT Statements
⇐ What Is fn_virtualfilestats()
2019-06-29, 1698🔥, 0💬
Popular Posts:
How to Pass Windows Environment Variable to JMeter? I want to use Windows temporary folder environme...
How to use HTTP protocol to post an XML message to a server? You can follow this tutorial to post an...
How to validate and decode MAC (Media Access Control) addresses? In order to help your programming o...
How to generate user birthday dates? Test user birthday dates are frequently needed in testing appli...
How to generate user full names? Test user names are frequently needed in testing applications that ...