364,036 Members | 5410 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

VARCHAR vs. LONG VARCHAR

John Smith
P: n/a
John Smith

What is the difference? Is LONG VARCHAR only 28 bytes longer then VARCHAR?
Is this the only difference?


Jun 28 '06 #1
Share this Question
Share on Google+
2 Replies


Mark A
P: n/a
Mark A
"John Smith" <john.smith@microsoft.com> wrote in message
news:JGoog.4006$oj5.1345287@news.siol.net...[color=blue]
>
> What is the difference? Is LONG VARCHAR only 28 bytes longer then VARCHAR?
> Is this the only difference?[/color]

Originally VARCHAR was limited to a length of 255, so LONG VARCHAR was
needed, but obviously they both support about 32K now (VARCHAR supports 28
bytes less as you mentioned).

One big difference between VARCHAR and LONG VARCHAR is that LONG VARCHAR is
stored in a separate area like a LOB (CLOB, BLOB, etc) and also like a LOB,
does not use bufferpools, so every select, insert, update, or delete of a
LONG VARCHAR requires direct disk I/O, just like LOBs.

In order to use the 32K bufferpool for VARCHAR, they had to make the maximum
size 28 bytes shy of 32K (although you may have to make it even smaller to
ensure your entire row fits in a 32K page, accounting for page and row
overhead)..

For this reason (and because IBM will be phasing out LONG VARCHAR in a
future release), you should not use LONG VARCHAR on any new development.


Jun 28 '06 #2

John Smith
P: n/a
John Smith

Thank you.


Jun 28 '06 #3

Post your reply

Help answer this question



Didn't find the answer to your DB2 Database question?

You can also browse similar questions: DB2 Database