Is there a good reason I see VARCHAR(255) used so often (as opposed to another length)?

后端 未结 10 639
Happy的楠姐
Happy的楠姐 2020-12-12 10:38

In multiple courses, books, and jobs, I have seen text fields defined as VARCHAR(255) as kind of the default for \"shortish\" text. Is there any good reason that a length o

10条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 11:21

    Historically, 255 characters has often been the maximum length of a VARCHAR in some DBMSes, and it sometimes still winds up being the effective maximum if you want to use UTF-8 and have the column indexed (because of index length limitations).

提交回复
热议问题