Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> drop table vs truncate table -- performance
Hi:
Oracle 8173 on Sun Solaris 2.8.
I am running a program that creates and drops tables repeatedly in a schema.
The table dropping part looks like this:
drop table ypd.t1 cascade constraints; drop table ypd.t2 cascade constraints; drop table ypd.t3 cascade constraints; drop table ypd.t4 cascade constraints;
I thought I might be able to use "truncate table ..." and then "drop table ..." to make this process a bit faster. However the tests I did today showed otherwise:
SQL> select bytes from dba_segments where segment_name='SEQUENCE';
BYTES
SQL> create table ypd_owner.SEQUENCE1
2 tablespace ypd nologging as select * from mt.SEQUENCE;
Table created.
Elapsed: 00:04:272.50
SQL> drop table ypd_owner.SEQUENCE1;
Table dropped.
Elapsed: 00:00:05.19
SQL> create table ypd_owner.SEQUENCE1
2 tablespace ypd nologging as select * from mt.SEQUENCE;
Table created.
Elapsed: 00:04:275.85
SQL> truncate table ypd_owner.SEQUENCE1;
Table truncated.
Elapsed: 00:00:06.99
SQL> drop table ypd_owner.SEQUENCE1;
Table dropped.
Elapsed: 00:00:00.70
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: gmei
INET: gmei_at_incyte.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Mon Mar 10 2003 - 15:39:31 CST
![]() |
![]() |