| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Hypothetical questions
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_at_news2.rdc2.tx.home.com>,
"Michael O'Neill" <mjoneill_at_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.
Received on Tue Dec 12 2000 - 08:27:38 CST
![]() |
![]() |