Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: add a new column into the middle of an existing table

Re: add a new column into the middle of an existing table

From: Nuno Souto <nsouto_at_optushome.com.au.nospam>
Date: Wed, 1 May 2002 21:37:31 +1000
Message-ID: <3ccfd481$0$15478$afc38c87@news.optusnet.com.au>


In article <aanpsk01hv1_at_drn.newsguy.com>, you said (and I quote):
>
> 1. Storage - if you have a null column in the middle of a row, there is a
> length indicator for the null column. If the null column is at the end of the
> row there is no length indicator. Not a major concern, but there is some wasted
> space having null columns in the middle of a row.
>
> 2. Performance - when Oracle reads a row for a query it only reads as far along
> the row as it needs to satisfy the query. Let's say you had a query that needed
> only the first two columns in the row. The rest of the row is not read. Since
> mandatory columns can also be queried frequently, this may mean that when you
> add a mandatory column that it's useful to add it at the front of the row.
>

And the most important:

3- Compatibility - when the database has 3 tons of code written with the following general syntax:

INSERT INTO <tablename> VALUES(:col1,:col2,:col3...);

instead of:

INSERT INTO <tablename> (COL1,COL2,COL3...) VALUES (:col1,:col2,:col3...);

In the first case, if the new column went anywhere but the "end" of the previous columns, you'd have a big mess in your hands!

One of these days someone should write a book on how to design and code defensively. As in: designed and written to avoid likely future problems.

-- 
Cheers
Nuno Souto
nsouto_at_optushome.com.au.nospam
Received on Wed May 01 2002 - 06:37:31 CDT

Original text of this message

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