In a slightly heated discussion on TDWTF a question arose about the size of varchar columns in a DB.
For example, take a field that contains the name of a person (just name, no surname). It's quite easy to see that it will not be very long. Most people have names with less than 10 characters, and few are those above 20. If you would make your column, say, varchar(50), it would definately hold all the names you would ever encounter.
However for most DBMS it makes no difference in size or speed whether you make a varchar(50) or a varchar(255).
So why do people try to make their columns as small as possible? I understand that in some case you might indeed want to place a limit on the length of the string, but mostly that's not so. And a wider margin will only be beneficial if there is a rare case of a person with an extremely long name.
Added: People want references to the statement about "no difference in size or speed". OK. Here they are:
For MSSQL: http://msdn.microsoft.com/en-us/library/ms176089.aspx
The storage size is the actual length of data entered + 2 bytes.
For MySQL: http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html
L + 1 bytes if column values require 0 – 255 bytes, L + 2 bytes if values may require more than 255 bytes
I cannot find documentation for Oracle and I have not worked with other DBMS. But I have no reason to believe it is any different there.
For each row, Oracle Database stores each value in the column as a variable-length field... For example, assume you declare a column VARCHAR2 with a maximum size of 50 characters. In a single-byte character set, if only 10 characters are given for the VARCHAR2 column value in a particular row, the column in the row's row piece stores only the 10 characters (10 bytes), not 50.
– Dingy