Is there any benefit to my rather quirky character sizing convention?

Posted by Paul Alan Taylor on Stack Overflow See other posts from Stack Overflow or by Paul Alan Taylor
Published on 2010-02-23T15:59:19Z Indexed on 2010/05/02 13:07 UTC
Read the original article Hit count: 264

I love things that are a power of 2. I celebrated my 32nd birthday knowing it was the last time in 32 years I'd be able to claim that my age was a power of 2. I'm obsessed. It's like being some Z-list Batman villain, except without the colourful adventures and a face full of batarangs.

I ensure that all my enum values are powers of 2, if only for future bitwise operations, and I'm reasonably assured that there is some purpose (even if latent) for doing it.

Where I'm less sure, is in how I define the lengths of database fields. Again, I can't help it. Everything ends up being a power of 2.

CREATE TABLE Person
(
    PersonID int IDENTITY PRIMARY KEY
   ,Firstname varchar(64)
   ,Surname varchar(128)
)

Can any SQL super-boffins who know about the internals of how stuff is stored and retrieved tell me whether there is any benefit to my inexplicable obsession? Is it more efficient to size character fields this way? Can anyone pop in with an "actually, what you're doing works because ....."?

I suspect I'm just getting crazier in my older age, but it'd be nice to know that there is some method to my madness.

© Stack Overflow or respective owner

Related posts about microsoft-sql-server

Related posts about binary