views:

22

answers:

1

Is there any tool available by which one can calculate the size or a single row in sqlserver. This would really help in calculating the expected size of DB. Further one option can be to use sp_spaceused but it gives the details of the whole table... what we want is the size of a record (maximum size) in a table.

Further is there any tool to check the amount of traffic that is hitting the server so as to enable to identify the bottlenecks.

Thanks in advance.

+1  A: 

You don't need a tool for this, it's a very simple query to write:

SELECT SUM(length)
FROM syscolumns
WHERE id = OBJECT_ID('MyTable')
Aaronaught
This is giving a value like '67' in result. Is this the size of the row in KB or something else ?
HotTester
@HotTester: Individual row sizes are always in bytes. The size can never be more than 8060 bytes (slightly less than 8 KB).
Aaronaught
This puzzles me.. say if i am saving a picture (size 200kb) in a row then wouldn't the size would increase beyond 8 KB of the row ?
HotTester
@HotTester: Columns like `varchar(max)` and `varbinary(max)` are not in-row data, they are LOB data stored outside the row. P.S. please don't store images in your database unless you are using SQL 2008's `FILESTREAM` type, it will lead to poor performance.
Aaronaught