Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> REPOST: TRUNCATE v DROP TABLE question
Truncate table simply drops the high water mark right down to the
'bottom' of the data in the table, so the table is effectively, empty.
There is minmal redo generated. Indexes remain but are emptied. If there
was data in the table, Oracle marks as UNUSABLE any and all
non-partitioned indexes and all partitions of global partitioned indexes
on the table - if there were any.
Drop table cascade constrainst drops the table, deallocates all the extents, removes the indexes and deallocates their extents and effectively removes the table from the database. Much redo is generated.
Delete from table removes the data rows from the table, and can be rolled back until such time as you commit (or you carry out a DDL command which implicitly commits !)
Under Oracle 817, there is ALTER INDEX blah DISABLE and ALTER INDEX blah ENABLE - that might help.
If so, I'd truncate the table and disable the indexes. If there is a lot of data to be re-loaded subsequently, I'd also use REUSE STORAGE on the truncate to save dynamic allocation/de-allocation.
HTH
Regards,
Norman.
Norman Dunbar EMail: Norman.Dunbar_at_LFS.co.uk Database/Unix administrator Phone: 0113 289 6265 Fax: 0113 289 3146 Lynx Financial Systems Ltd. URL: http://www.Lynx-FS.com
------------------------------------------------------------------------
-----Original Message-----
From: harry [mailto:a_at_abc.com]
Posted At: Thursday, January 24, 2002 12:08 PM
Posted To: server
Conversation: TRUNCATE v DROP TABLE question
Subject: TRUNCATE v DROP TABLE question
Using Oracle 8i on NT Server 4 (sp6a)
I have a table that gets populated from scratch every week or so using a
"CREATE TABLE tablename as
SELECT ..." statement.
As the table is very large its a bit tricky to try all different speed
tests on it so I was
wondering if somebody could tell me if this is the quickest way to do
this?
Should I -
Many thanks
HArry
This message was cancelled from within The Unacanceller's glorious new software, Lotus 1-2-3 For Rogue Cancellers. Received on Thu Jan 24 2002 - 08:23:01 CST