Answers

Question and Answer:

  Home  Sybase

⟩ Why not max out all my columns Sybase?

People occasionally ask the following valid question:

v Suppose I have varying lengths of character strings none of which should exceed 50 characters.

Is there any advantage of last_name varchar(50) over this last_name varchar(255)?

That is, for simplicity, can I just define all my varying strings to be varchar(255) without even thinking about how long they may actually be? Is there any storage or performance penalty for this.

There is no performance penalty by doing this but as another netter pointed out:

If you want to define indexes on these fields, then you should specify the smallest size because the sum of the maximal lengths of the fields in the index can't be greater than 256 bytes.

and someone else wrote in saying:

Your data structures should match the business requirements. This way the data structure themselves becomes a data dictionary for others to model their applications (report generation and the like).

 157 views

More Questions for you: