When I define columns in MySQL, I usually use int, varchar (255), text, and random enumeration for boolean. What are the benefits of accurately specifying column types, rather than just their maximum?
For example, a password field encoded as MD5 will never exceed 32 characters, is there any tangible performance boost from using varchar (32) to varchar (255)?
Per manual , a VARCHAR(N)given actual length, takes up the same amount of space for any N up to 255, so using 32 does not require free space. But there is an advantage to the clarity and readability of your circuit in using the type that best matches the evidence.
VARCHAR(N)
I agree with what Clyde says, but your example password is not particularly good. Since the sum of MD5 should ALWAYS be 32 characters, you can use CHAR (32) instead of VARCHAR (32), which in many cases will be faster / more efficient.
, . -. , int, char ( ) .
, 100 . , . varchar .
, , -/.
, / , . , .
, , db, . , : ", 100 , ". , , , varchar (255), .
255 50 - .
In SQL Server, I will take care to put my name, address, etc. in NVarCharso that I can internationalize when necessary. I have a phone number that can store more than 10 digits in the USA.
NVarChar
Source: https://habr.com/ru/post/1712211/More articles:Reset URL - .netcompilers for languages from the 1950s and 1960s - language-agnosticЧто случилось с этим запросом mysql? - phpTab over JTable component - javaHadoop header file processing - hadoopReading / writing a password protected and encrypted file in ruby - ruby | fooobar.comWinForms keypress not working correctly - c #Search for "day view" javascript library / plugin / calendar - javascriptLooping Over Dictionary в С# - collectionsHow can I bind a child control to my parent form when it was disabled on the screen with low resolution? - c #All Articles