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: VARCHAR2 vs. CHAR

Re: VARCHAR2 vs. CHAR

From: Jacob Love <jlove_at_engin.umich.edu>
Date: 1997/04/03
Message-ID: <5i0i96$1bn@srvr1.engin.umich.edu>#1/1

In article <334183EF.4E1B_at_bga.com>, BoB Pierce <rjpierce_at_bga.com> wrote:
>Could someone shed some light on the difference between using CHAR and
>VARCHAR2 for strings? I understand that VARCHAR2 will be more efficient
>storage-wise by only using as many characters as the input string
>requires, but I have also heard that performance may be negatively
>impacted with VARCHAR2 types because Oracle must look up the length of
>the strings all the time.

Varchar2 stores a variable length string up to 2k and there is no storage penalty for strings shorter than the maximum specified. CHAR datatype will pad any string that does not fill the specified length. Padding makes the SQL a bit trickier, so queries and reports all have to take it into consideration. While I have occasionally heard that CHAR is more efficient than VARCHAR, I don't think even if it is true it will have a major impact on most applications. I have used varchar successfully since it became a real option with version 7, and I wouldn't switch unless the application forced me to do so.

-- 
-----------------------
Jack F. Love
Opinions expressed are mine alone, unless you happen to agree
Received on Thu Apr 03 1997 - 00:00:00 CST

Original text of this message

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