When I define columns in MySQL I generally use int, varchar(255), text and the occasional enum for boolean. What are the benifits of accurately specifying column types rather than just leaving them at maximum?
For example a password field encoded as MD5 will never exceed 32 characters so is there a tangible performance gain from using varchar(32) over varchar(255)?
Per the manual, aVARCHAR(N) of a given actual length takes the same amount of space for any N up to 255, so using 32 saves no space. But there's an advantage of clarity and readability of your schema in using a type that best represents what the actual data must be like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With