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

internal,detailed workings of truncate

From: <dellera_at_my-deja.com>
Date: Sat, 28 Oct 2000 21:59:56 GMT
Message-ID: <8tfi8p$9us$1@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 - 16:59:56 CDT

Original text of this message

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