Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I know that tables can span across multiple data files

The tables are already created. I did not create them myself. I'm trying to find out what table(s) are using the highest amount of IO. I was able to find out what data files are using high IO using the sys.fn_virtualfilestats function.

Question : Is there a way to find out what files the tables are associated with?

share|improve this question

migrated from stackoverflow.com Dec 13 '11 at 11:50

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

You can find directly which rowset (partition of an index/heap) belongs to which filegroup: look at data_space_id in sys.allocation_units. But is not going to give you details at the individual file-within-filegroup level. It is possible to find exactly how each rowset page lays out in each file by chasing the IAM chains manually, or by using undocumented features like DBCC IND or %%physloc%%. Not trivial, but possible.

But I would encourage you to go down a different path. Specially in the light of your comment about correlating space used in the file with IO, since the largest file by size does not necessarily imply most IO in the file (think data at rest). Instead, use sys.dm_db_index_usage_stats and, especially, sys.dm_db_index_operational_stats instead. You will get the load on each rowset, and then you can correlate this with the actual physical IO.

share|improve this answer
    
thank you for your comments both of these will help me solve my issue. Thanks again –  RodMeans Dec 8 '11 at 21:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.