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

Home -> Community -> Usenet -> c.d.o.server -> Re: char vs. varchar

Re: char vs. varchar

From: Johan Thorselius <johan.thorselius_at_outright.se>
Date: Wed, 06 Jan 1999 21:13:43 +0100
Message-ID: <3693C3F7.ADDA8C60@outright.se>


Very interesting question.

I think the original question was merely looking on how to optimize, merely where the breakeven for I/O is
b/w fixed char and variable varchar. I know that for DB2 it's well known that the breakeven for I/O
is around char(8), so I wonder if there is a corresponding rule in Oracle ?? Else I agree that varchar is
better, especially for avoiding padding of blanks.

Johan Thorselius

Kevin S Hoffman wrote:

> to the best of my knowledge, the difference between storage
> of char and varchar is that if you have a field that is a char(20),
> then if you store 1 character in it, Oracle will store 19 spaces
> after that... Essentially giving you a fixed-length field. If you use
> a varchar(20), and store 1 character, Oracle only maintains
> the 1 character, and an internal indicator as to the size of the
> 'actual' data in the varchar field.
>
> Unless you know that every record is going to have a fixed-length,
> same-size field, and you're not just storing single-character data (like 'Y'
> or 'N'),
> then I'd recommend sticking with varchar2.


Received on Wed Jan 06 1999 - 14:13:43 CST

Original text of this message

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