patternsqlMinor
Find the disk size of specific rows
Viewed 0 times
rowsfindthedisksizespecific
Problem
I am trying to figure out the disk size a number of rows in various tables take up.
I can define this rows by a query. How can I find out the actual disk size that corresponds to the result set in SQL Server?
The reason why I want to know this, is that I am trying to analyse a multi-tenant system.
I am trying to get the total size each tenant takes up on the system. So I need the size of all rows pertaining to each tenant and the size each tenant is using in index tables, etc.
The tenants all share the same schema, so it is not easy to do.
I can define this rows by a query. How can I find out the actual disk size that corresponds to the result set in SQL Server?
The reason why I want to know this, is that I am trying to analyse a multi-tenant system.
I am trying to get the total size each tenant takes up on the system. So I need the size of all rows pertaining to each tenant and the size each tenant is using in index tables, etc.
The tenants all share the same schema, so it is not easy to do.
Solution
One way is to look at the
If you want to see the size of a particular record, another way is to find the physical row location, see SQL Server 2008: New (undocumented) physical row locator function. You can then dump the row physical structure, see Anatomy of a Record.
Finally you can use the product documentation to estimate the size:
sys.dm_db_index_physical_stats output. The min_record_size_in_bytes, max_record_size_in_bytes and avg_record_size_in_bytes will give you the sizes you want.If you want to see the size of a particular record, another way is to find the physical row location, see SQL Server 2008: New (undocumented) physical row locator function. You can then dump the row physical structure, see Anatomy of a Record.
Finally you can use the product documentation to estimate the size:
- Estimate the Size of a Clustered Index
- Estimate the Size of a Nonclustered Index
- Estimate the Size of a Heap
Context
StackExchange Database Administrators Q#17011, answer score: 9
Revisions (0)
No revisions yet.