Why historically do people use 255 not 256 for database field magnitudes?

前端 未结 12 739
北荒
北荒 2020-12-07 07:17

You often see database fields set to have a magnitude of 255 characters, what is the traditional / historic reason why? I assume it\'s something to do with paging / memory l

12条回答
  •  情歌与酒
    2020-12-07 08:08

    <<

    Recollected the fundamentals of the bits/bytes storage, it requires one byte to store integers below 256 and two bytes for any integer between 256 and 65536. Hence, it requires same space (two bytes) to store 511 or 512 or for that matter 65535.... Thus it is clear that the this argument mentioned in the discussion above is N/A for varchar(512) or varchar(511).

提交回复
热议问题