• nadersam (3/29/2016)


    GilaMonster (3/29/2016)


    Space used + 2 bytes.

    As for make everything varchar(8000), why? Is a person's first name going to be thousands of characters long? A city name? A company name? An address line?

    No, none of those are ever going to be that kind of size. The longest city name in the world is 176 characters (and that city is usually written with a much shorter name - Bangkok). Address lines sizes are mandated by the postal service, they won't be thousands of characters long.

    As with all design choices, use the appropriate data type (and length) for the data being stored as a form of constraint. Making everything 8000 is lazy design (and makes indexing much harder).

    Thank you for your reply.

    I am asking to check what's the performance impact of defining sizes much bigger than what's actually needed.

    Also you mentioned it's harder for indexing , can you please explain why?, isn't it going to be the same concept.

    Thanks again.

    Nader

    From a performance standpoint this would, in essence, prevent page level locks for rows returned with this data full or I believe at least 4001 bytes full.