Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2009
    Posts
    2

    Unanswered: Long Varchar vs Varchar in ZOS DB2

    Hi ,
    When i read in redbooks , it was given that both varchar and longvarchar can with hold 32k bytes at the max . Then could anyone explain the difference between these 2 data types?

    Thanks
    Saba

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    At one time, VARCHAR max was only about 255 bytes, so LONG VARCHAR was useful. However, the problem with LONG VARCHAR is that it is treated like a LOB and does not use DB2 bufferpool memory (requires synchronous I/O to disk for inserts, updates, deletes, and selects).

    Now that VARCHAR can be almost as large as LONG VARCHAR (just a few bytes less assuming that all columns in the table fit in the maximum row size, and that the page size is appropriate), there is no reason to use the poor performing LONG VARCHAR, and in fact it is "deprecated" (still there, but IBM may remove it in future releases).

    If you cannot use a VARCHAR for some reason, use a LOB (CLOB or BLOB).
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •