Why are SQL fields lengths always (2^n)-1 unless less than 127?

I remember the old times, when using 2^n Length was better vor alignment of blocks on disk or memory. Aligned block were faster. Today "Block" sizes are bigger and memory and disk are fast enough to ignore the alignment, exept for very large blocks that ist. (Whatever "very large" means today....)

Nowadays it is just traditional to do so.

And another reason my be the famous saying: There are only 10 type of people: Those who can binary and the others.

And 2^n -1 are candidates for mersenne primes. so its geeky too...


I think it's just programmers picking a number out of the air when it doesn't really matter.

If you had to put a limit on "notes" field for example a non programmer would probably pick 100 or 200 characters as a round number whereas a programmer might think of 127 or 255 as a round number.


I can't say as I've seen the "-1" trend used differently for smaller / larger fields. However I think its all nothing more than developer/dba OCD. Always wanting "round" numbers when they should really be making field length decisions based on business rules rather than "prettiness"