Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Field Lengths: Factors of 2?

Author  Topic 

mattsmith321
Starting Member

12 Posts

Posted - 2001-05-23 : 22:44:43
Before I arrived on this project, someone on our back-end team convinced everyone that field lengths should be declared as factors of 2 (i.e. 1, 2, 4, 8, 16, 32, 64, 128, etc.) for the database and XML attribute lengths and hence the UI. I believe the reasoning was that that was how space was allocated. For example, a 20-byte field was going to take up 32-bytes anyway, so might as well make it 32-bytes.

Everyone already knows (now) that the advice that this person dispenses is to be taken with a grain of salt. However, I could swear that I saw something like this in a sample database with that same thought process documented.

I can see, maybe, how this might fractionally improve data storage efficiency but not to the point of worrying about a few extra bytes. Maybe multiples of 8, but not factors of 2. Maybe in the good ol' days when you had to chop the century off the year to save a few bytes, but I can't see it making much difference these days.

Can anyone shed any light on this topic? Does anyone out there practice this? Does it really make any worthwhile difference?

Thanks,
Matt

   

- Advertisement -