Database table schema design - varchar(n). Suitable choice of N
- by morpheous
Coming from a C background, I may be getting too anal about this and worrying unnecessarily about bits and bytes here.
Still, I cant help thinking how the data is actually stored and that if I choose an N which is easily factorizable into a power of 2, the database will be more effecient in how it packs data etc.
Using this "logic", I have a string field in a table which is a variable length up to 21 chars. I am tempted to use 32 instead of 21, for the reason given above - however now I am thinking that I am wasting disk space because there will be space allocated for 11 extra chars that are guaranteed to be never used. Since I envisage storing several tens of thousands of rows a day, it all adds up.
Question:
Mindful of all of the above, Should I declare varchar(21) or varchar(32) and why?