View previous topic :: View next topic |
Author |
Message |
Tanuj Beginner
Joined: 27 Feb 2004 Posts: 5 Topics: 3
|
Posted: Fri Feb 27, 2004 2:48 am Post subject: Disadvantages of Usage of VARCHAR |
|
|
Hi, Could an body please let me know what are the disadvantges of using a VARCHAR instead of CHAR in DB2, specially in case where VARCHAR is defined more than 255 length.
I have read that if VARCHAR is defined more than 255 length, then this may cause perforamance realted issue, when VARCHAR is fetched via SELECT Query due repetitive compression and Decompression of VARCHAR String. |
|
Back to top |
|
 |
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Fri Feb 27, 2004 4:47 am Post subject: |
|
|
For strings longer than 255 characters there is no alternative for using VARCHAR.
The only argument for using VARCHARs shorter than 255 was space efficiency. But coding for VARCHAR columns in statis SQL is anoying, and with the compression functionality for tablespaces that space argument is gone.
regards
Christian |
|
Back to top |
|
 |
Anovice Beginner
Joined: 18 Feb 2004 Posts: 12 Topics: 2
|
Posted: Fri Feb 27, 2004 5:37 am Post subject: |
|
|
It is generally a good design to have varchar columns as the last columns in the table. DB2 maintains offsets for where each column begins for every table. If there are varchars in the middle then DB2 will have to calculate these offsets every time the column in accessed and it causes performance problems. |
|
Back to top |
|
 |
|
|