If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Long Varchar vs Varchar in ZOS DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-15-09, 10:57
avatar1234 avatar1234 is offline
Registered User
 
Join Date: Dec 2009
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 12-15-09, 12:50
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On