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

前端 未结 12 753
北荒
北荒 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:06

    Often varchars are implemented as pascal strings: holding the actual length in the byte #0. The length was therefore bound to 255. (Value of a byte varies from 0 to 255.)

提交回复
热议问题