Sei sulla pagina 1di 3

1/10/2019 Hypercharge Oracle truncate table performance

��

Search BC Oracle Sites Hypercharge Oracle truncate table


Custom Search
Search
performance
Home
Oracle Database Tips by Donald BurlesonMay 21, 2015

E-mail Us
Oracle Articles
New Oracle Articles
Question (Balasubramanian .J): I have a very large 50 gig table and I?ve had
cases where a truncate table hangs. I understood that there we no performance
issues with a truncate table since it only nulls the high water mark. What causes
poor performance problems with truncate table? I have tried to truncate table
Oracle Training before which took 32 hours to get truncated.
Oracle Tips
Oracle Forum
Answer: (from forum): Truncate performance is directed related to system load,
and truncates will always run fast on an idle database, or on a database with low
Class Catalog
activity.

Oracle does have to free-up extents within the table, perhaps that is the source of
Remote DBA the waiting and during a truncate you may see two wait events in v$session_wait:
Oracle Tuning "rdbms ipc reply" and "local write wait".
Emergency 911
There are also slow truncate performance reports where you should create a
RAC Support
smaller cache, dedicated to the specific (partitioned ) object. This is done by
Apps Support
moving the partition into a separate blocksize which is defined with a separate
Analysis
data buffer. See my notes on deploying multiple blocksizes for additional details.
Design
Implementation For non-partitioned tables, you can create a db_16k_cache_size of 500 meg and
Oracle Support adjust the table to use the tiny buffer.

I gather you have already truncated the table at least once, but it takes too long. If
that's true, consider the REUSE STORAGE option. If that isn't feasible, check if
SQL Tuning the table is in a dictionary-managed tablespace. If it is, try increasing the extent
Security size - releasing lots of extents in a dictionary-managed tablespace is really slow.
Oracle UNIX Better yet, change to a locally-managed tablespace. As noted you can use the
Oracle Linux syntax like:
Monitoring
Remote support
TRUNCATE TABLE BIG_TABLE REUSE STORAGE;
Remote plans
- You may want to check you patch level for BUGS with truncate.
Remote services
Application Server - Limit the activity on the system (preferably none).
Applications
Oracle Forms - Increase redo log size if you are having frequent log switches (more
Oracle Portal than one every 15 minutes or so)
App Upgrades
SQL Server
- If using Oracle 9i, check out the db_writer_processes (Increase
DBWR Throughput Note: 62172.1). That can improve truncate table
Oracle Concepts
speed.
Software Support
Remote Support - Check whether you are using a dictionary-managed tablespace:
Development
select
Implementation extent_management
from
user_tablespaces
where
tablespace_name in
(select tablespace_name from user_tables where
Consulting Staff table_name='50GBTABLE');

www.dba-oracle.com/t_truncate_table_performance.htm 1/3
1/10/2019 Hypercharge Oracle truncate table performance
Consulting Prices
Help Wanted! - If you are, check how many extents in that table. If it's more than
20,000 extents, I would be concerned that a truncate table would be
too slow.
select extents from user_segments where segment_name='50GBTABLE';

Oracle Posters I have seen truncate table or drop table statements take a very long time to
Oracle Books complete because the table was very badly fragmented, that is, it had a lot of
Oracle Scripts
extents. If you have lots of extents, those extents must be released when you do a
drop, or when you do a truncate without "reuse storage". If you have 100,000 or
Ion
more extents in a dictionary-managed tablespace that can take hours; I've heard of
Excel-DB
it taking days. If you use "reuse storage", then those extents will not be released.
Don Burleson Blog
If you have plenty of disk space, you could rename this table and then create a
new table with the same name and structure as this one. The new table should be
in a locally-managed tablespace with uniform extent size of 10 MB or more, so
you won't have this truncate table problem again in the future.

See related articles here:

Oracle TRUNCATE tips


Truncate: A One-Way Trip
The TRUNCATE TABLE Command

Burleson is the American Team

www.dba-oracle.com/t_truncate_table_performance.htm 2/3
1/10/2019 Hypercharge Oracle truncate table performance

Note: This Oracle documentation was created as a support and Oracle training
reference for use by our DBA performance tuning consulting professionals. Feel
free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support


expert should independently investigate their credentials and experience, and
not rely on advertisements and self-proclaimed expertise. All legitimate Oracle
experts publish their Oracle qualifications.

Errata? Oracle technology is changing and we strive to update our BC Oracle


support information. If you find an error or have a suggestion for improving our
content, we would appreciate your feedback. Just e-mail:

and include the URL for the page.

Burleson Consulting
The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services

Copyright © 1996 - 2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by


Conversational

www.dba-oracle.com/t_truncate_table_performance.htm 3/3

Potrebbero piacerti anche