From: denevge@my-deja.com
Newsgroups: comp.databases.oracle.server
Subject: Re: Hypothetical questions
Date: Tue, 12 Dec 2000 14:27:38 GMT
Organization: Deja.com - Before you buy.
Lines: 76
Message-ID: <915ckj$d9u$1@nnrp1.deja.com>
References: <9146oh$hko$1@nnrp1.deja.com> <PWhZ5.17481$x6.9542876@news2.rdc2.tx.home.com>
NNTP-Posting-Host: 194.7.184.218
X-Article-Creation-Date: Tue Dec 12 14:27:38 2000 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
X-Http-Proxy: 1.1 x54.deja.com:80 (Squid/1.1.22) for client 194.7.184.218
X-MyDeja-Info: XMYDJUIDdenevge


varchar <-> char

the main difference is that
varchar has a non-fixed length
char has a fixed length

When you define a char(20), it always takes 20 bytes.  It doesn't
matter what is in the field.
When you defina  a varchar2(20), the number of bytes it takes depends
on the data stored in the field. Let's say we put the string "DEJA" in
the field, the fields take 4 bytes + length indicator = 5 bytes.
It's because of that non-fixed length, that it's possible that doing an
update of a varchar2 can cause  migration of the row.  When updating a
varchar2 field, it's possible that the new record doesn't fit in the
block no more and it has to be migrated.

Hope this helps
gert
In article <PWhZ5.17481$x6.9542876@news2.rdc2.tx.home.com>,
  "Michael O'Neill" <mjoneill@email.com> wrote:
> Comments inline
>
> > 1.  BLOBs -- ...  If you had the chance to redesign your data model
> > from scratch, would you continue to store your BLOBs internally, or
> > would you look at storing them outside the database and why?
>
> It depends.  If the data is something that needs to be stored, kept
 and
> retreived for legal reasons now and years down the road, like an
 Acrobat
> .pdf contract - storing as a BFILE may be a very bad idea.  Otherwise
> storing as a BFILE has always worked out to be the least amount of
 work for
> me.  Either or, both the logical and physical model, in my mind
 would 'look'
> the same.  What is different is the available access to the data via
 the
> DBMS_LOB package, storage consumption and recovery options, as well as
> performance - which all depend on the usage of the data.  For store
 and
> forget data, (very little retreival/modification) I have not
 discovered any
> great performance differences.
>
> > 3)  Char vs. Varchar2?  I have heard the following arguments for
 char
> > vs. varchar2:
> >    a)  argument 1:  You should always use varchar because you save
> > space.
> >    b)  argument 2:  Use char when all possible values stored in a
 column
> > are about the same length, use varchar when they can have widely
> > different lengths.
> >    c)  argument 3:  Use char instead of varchar, because varchar can
> > cause a row to span multiple blocks, thus taking longer to retrieve
> > data.
> >
> >    Which philosophy (a, b, or c, or another different philosophy
> > altogether) would you choose when designing a data model and why?
>
> It depends.  Generally #1, though.  I don't understand the validity in
> stating #2.  #3 is not pertinent on whether the data is volitale or
 not.
> For the most part, the person doing the physical data modeling will
 have
> worked through these issues, using their experience.  There just
 isn't any
> fixed philosophy to answer your question succinctly.  There are
 simply more
> dimensions to consider than the question you ask alone.
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.

