Re: oracle disk space

From: Thomas B. Cox <tcox_at_qiclab.scn.rain.com>
Date: 4 Mar 92 20:45:57 GMT
Message-ID: <1992Mar4.204557.8668_at_qiclab.scn.rain.com>


In article <19924.972.6724_at_dosgate> "howard kaplan" <howard.kaplan_at_canrem.com> writes:
>I have heard an unconfirmed *rumour* about disk space usage in
>future versions of Oracle. According to this rumour,
 

>1) Character fields will have all of their trailing blanks stored on
> the database, requiring much more disk space than at present.

In v6, the datatype CHAR stores no trailing blanks (no 'padding').

In v7, by default, calling something CHAR works the same as in v6. However, if you specify non-v6-compatible-mode, you will see the following two datatypes:

	CHAR		pads with trailing blanks to fill space
	VARCHAR2	behaves like v6 CHAR

	VARCHAR		is a reserved word; the ANSI committee is
			still trying to define how *they* think 
			VARCHAR should behave.

Your v6 CHAR fields automatically become v7 VARCHAR2 fields, but you may still refer to this non-padding datatype with the word 'CHAR' as long as you're in v6 compatibility mode.

>2) This change is required for conformity to an SQL standard.

The ANSI committee decided that the CHAR datatype should pad. (I forget which ANSI standard this was, maybe ANSI SQL-2, maybe SQL89, I dunno. If you really care I'll go find out.)

>This is especially confusing, because I thought that SQL only
>specified logical representations, not physical ones.

Beats me.

>Can anyone clarify the truth behind this rumour?
 

> Howard Kaplan, Toronto
> howard.kaplan_at_canrem.com
 

>Canada Remote Systems - Toronto, Ontario/Detroit, MI
>World's Largest PCBOARD System - 416-629-7000/629-7044

Two final points.

One, the padding behavior can perhaps be useful if you're looking for certain kinds of performance gains, because after the RDBMS finds the row it wants, it can skip in a fixed distance (the width of your padded CHAR field(s), in fact) to get the column it wants, rather than reading in the row looking for the begin-column marker for the desired column.

Two, I'm giving you this info from memory, from an Alpha-level v7 class I took some months ago. I don't have ANY reference material here, like the v7 DBA Guide. If anybody really cares about the details of this, like how exactly the word VARCHAR will be treated in v7 (is it really a reserved word? what if i try to define a column as having that datatype?), or how one turns on or off the v6 compatibility mode, then let me know.

Hope this helps.

Cheers.

-- 
Thomas Cox	   I work for Oracle, but I speak only for myself.
tcox_at_us.oracle.com				work: 503-220-1678
Received on Wed Mar 04 1992 - 21:45:57 CET

Original text of this message