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: internal,detailed workings of truncate

Re: internal,detailed workings of truncate

From: Barbara Kennedy <barbken_at_teleport.com>
Date: Sat, 28 Oct 2000 17:40:51 -0700
Message-ID: <flKK5.424$G5.163923@nntp1.onemain.com>

Truncate resets the high water mark on a table; so full scans will be faster subsequently. Which means that the DD on free extents gets changed. Jim
<dellera_at_my-deja.com> wrote in message news:8tfi8p$9us$1_at_nnrp1.deja.com...
> Hi everybody,
>
> I would appreciate if anyone could comment on the following description
> of how the TRUNCATE command works, as I have understood it.
> I know that it's common wisdom that TRUNCATE doesn't generate rollback
> and redo entries, but IMHO this is not 100% correct, because at least
> the changes to the data dictionary has to be both recorded in the
> rollback segment and in the redo log, to guard against corruption.
>
> In my opinion, when the TRUNCATE stmt is issued, the following
> events happen (rollback segment = RS, data dictionary=DD):
>
> 0) an internal commit takes place (since it's a DDL stmt);
>
> 1) the DD is modified, old values put in the RS, and both the
> changes to the DD and the RS are recorded in the redo;
>
> 2) if it were a DELETE FROM, the records in the table would be
> erased, their (old) values would be copied in the RS, then both
> the changes of the table and of the RS would be recorded in the
> redo log. But, since it's a TRUNCATE, Oracle simply neither erases
> nor copies the rows in the RS, and so it has nothing to record
> in the redo log. Hence the big savings in time;
>
> 3) perhaps another action like in 1) takes place;
>
> 4) an internal commit takes place, which records on disk the
> (small) entries in the redo log.
>
> Now, I could almost hear someone accusing me of being a bit
> pedantic ... but if this description is correct, the main
> implication is that i have deeply understood what DD, RS, redo and
> so on are, and I can move on happy and comfortable in my study
> of Oracle (think of it as "mental checkpoint" ;-) ).
> So, any comment would be MUCH appreciated.
>
> Thanks in advance, at least for reading
>
> Alberto
>
> P.S. By the way, anyone knows of any book/web site/white paper
> where issues are discussed at this level of details?
> Besides this NG, of course ...
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Sat Oct 28 2000 - 19:40:51 CDT

Original text of this message

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