Wednesday, July 9, 2014

DB2 CHAR VS VARCHAR

CHAR

VARCHAR disadvantages:
- uses 2 extra bytes to store the length
-  needs a little extra effort when storing and manipulating length of VARCHAR -> may affect efficiency


General Rule:
  • Use CHAR if average length of field is more than 6 bytes to save space
    • if average length of field is less than 6 bytes, there will be no storage savings for using char
  • Use varchar for columns with more that 30 characters (can be shorter for others)

No comments:

Post a Comment