Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should be the typical length of user's Full Name in database [duplicate]

Possible Duplicate:
List of standard lengths for database fields

Simple as that, what should be the typical length of allowed "Full Name" of a user in database?

When I create users table, I usually set it as varchar 31 or 32 (according to performance). What do you guys use and what's standard/typical convention.


Sidenote: I never face problem in email length (as I set it 254) and password (hash, 32 length).

like image 353
WhatIsOpenID Avatar asked Nov 28 '10 16:11

WhatIsOpenID


People also ask

What is the maximum length of a database name?

SQL maximum column name length limitation is 128 characters.

What is length in database?

The length prefix indicates the number of bytes in the value. A column uses one length byte if values require no more than 255 bytes, two length bytes if values may require more than 255 bytes.

What is the maximum length of a table name in SQL?

The maximum length of a table name is 64 characters long according to MySQl version 8.0. 12. Check your installed MySQL version. mysql> select version();

How long can a database table name be in SQL?

Table names must follow the rules for SQL Server identifiers, and be less than 128 characters.


1 Answers

The maximum your average varchar field allows (254?).

You are not winning anything by making it arbitrarily shorter. The fine-grained size controls on numbers and chars are more or less a relic from the past, when every byte mattered. It can matter today - if you are dealing with tens or hundreds of millions of rows, or thousands of queries per sec. For your average database (i.e. 99% of them) performance comes from proper indexing and querying, NOT making your rows a couple of bytes smaller.

Only restrict the length of a field when there is some formal specification that defines a maximum length, like 13 digits for an EAN code or 12 characters for an ISIN.

like image 85
Martin Avatar answered Sep 21 '22 23:09

Martin