Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Char vs. Varchar

Re: Char vs. Varchar

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Mon, 06 Nov 2000 19:07:48 +0000
Message-ID: <3A070184.2D9C@yahoo.com>

Mark Piffer wrote:
>
> On Wed, 1 Nov 2000 10:50:48 -0500, "Christopher Hurley"
> <cphurley_at_alumni.princeton.edu> wrote:
>
> >I am trying to decide whether to use varchar's or char's in a series of code
> >tables. The codes would range from perhaps 2, 3 and maybe 4 characters in
> >length, but no more. Originally, the plan was to use a char instead of
> >varchar because of better performance. Is there a significant performance
> >increase when using chars as opposed to varchars in lookups? Also, being
> >that the length of these columns will be small, the space gained by using
> >varchars will be minimal.
> >
> >Is there a big performance difference, and if so it what cases? If you have
> >any information on this topic, I would appreciate it. Thanks.
> >
> >Chris
> >
> >
>
> I doubt that you will win space by using VARCHAR2(4) over a CHAR(4).
> From what little I know, there must be a length-variable (at least 11
> bits) and a indirection-variable (some sort of pointer, for sure >= 4
> byte) so what you spare in characters you waste in book keeping.
> BTW, does somebody know how the Oracle guys do the VARCHAR2-allocation
> anyway? Can continuous updating of many varchar2 with changing lengths
> trash the performance? They should run into the same
> fragmentation-problems like a heap manager, shouldn't they?
>
> regards,
> Mark

length byte(s) followed by data. Since CHAR are stored in exactly the same way, then there is no difference in performance...

However, VARCHAR2 may induce row migration if rows are consistently updated to longer (and hence larger) values

HTH
Connor Received on Mon Nov 06 2000 - 13:07:48 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US