Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Varchar(1) or char(1) (WAS) Re: How insert new field in between?
Hi,
Just thought would share a thought or two on this. If the field length is 1 then using char makes more sense than varchar2. But if it is > 1 then I guess the kind of comparison that you want makes a difference. Not sure on this, but I think I have read somewhere that while comparing a char field a padded comparison is made while comparing a varchar2 field a non-padded comparison is made.
How far is that true ??
Regds
Amod
"Galen Boyer" <galenboyer_at_hotpop.com> wrote in message
news:uae0qfkql.fsf_-__at_verizon.net...
> On 23 Aug 2001, mark.powell_at_eds.com wrote:
>
> > There is no reason not to use varchar2(1) instead of char(1).
> > Oracle support had a recent thread where they stated both
> > columns will require the same amount of internal storage.
>
> Hm... The way I understood varchar2() there is a performance
> penalty when compared to char() because Oracle has to store an
> extra character on the row for each varchar2() column to define
> how big the stored field of varchar2() for that row was. Then,
> Oracle would know how to read across the row and grab the correct
> set of bytes. With a char(x), Oracle already knows. Therefore,
> char(x) would be faster for retrieval and where clause
> restriction but very limiting in functionality.
>
> Maybe varchar2(1) gets resolved to char(1) and then no
> performance penalty? (Of course, assuming that there is a
> performance penalty in the first place)
>
> --
> Galen Boyer
> It seems to me, I remember every single thing I know.
Received on Thu Aug 23 2001 - 22:52:04 CDT