January 20, 2012 at 1:17 pm
Hello Friends,
I am trying to figure out the row size in my table. I need a size of 1 row so that i can plan the capacity. could you guys please help me with this?
January 20, 2012 at 1:20 pm
Well, what's your table design? Can't help if you don't list the columns and data types.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 20, 2012 at 1:28 pm
Thank you for your quick reply. Please find below the table Def
Addres ----- varchar
Data ------ bit
User ------ varchar
Create_DT ------ datetime
January 20, 2012 at 1:41 pm
Varchar what? Varchar(1)? Varchar(400)? Varchar(8000)? Varchar(Max)?
Varchar columns are variable length, so what's the average length of the data that will be stored in them?
Which columns are nullable?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 20, 2012 at 1:49 pm
I am sorry ..i did not include the complete Table Def earlier ..Please find the info below
Addres --- varchar(30) --- Not Null
Data --- bit (1) --- Null
User ---varchar(30)--- Not Null
Create_DT datetime(8)---Not Null
Below is the Sp_spaceused info on the table
TableName ---Address
NumerofRows ----464
ReservedSize ----16KB
DataSize ---8KB
IndexSize------8KB
UnusedSpace------0KB
January 20, 2012 at 2:24 pm
All right, so 2 variable-length columns, 4 columns in total, one nullable
Record size:
tag bytes - 2 bytes
null bitmap offset - 2 bytes
fixed length columns - 9 bytes (the bit takes a full byte)
null bitmap - 1 byte (for the 4 columns)
Variable length column array - 4 bytes (2 per variable length column)
Variable length columns - between 0 and 60 bytes
Plus there's the slot array at 2 bytes.
(that is a little simplified)
So the minimum size that one of your rows can be is 18 bytes and the maximum is 78. What you populate into the varchar columns will affect whether the row is closer to 18 or to 78.
Does that help?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 20, 2012 at 7:12 pm
Thank you so much..that was really a great explaination
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply