Home » SQL & PL/SQL » SQL & PL/SQL » What Hapens to Index When I Truncate the source Table
What Hapens to Index When I Truncate the source Table [message #20137] Wed, 01 May 2002 01:52 Go to next message
Sulaiman Gboyega N.
Messages: 17
Registered: April 2002
Junior Member
Hi All,

Please I want to know what happens to an Index when the source table is truncate or dropped?

Thanks for your help.
Re: What Hapens to Index When I Truncate the source Table [message #20138 is a reply to message #20137] Wed, 01 May 2002 04:38 Go to previous messageGo to next message
sridhar
Messages: 119
Registered: December 2001
Senior Member
As far as I know,
Index gets dropped when table is dropped.
Index is not dropped when a table is truncated, TRUNCATE flushes out the data and sets the water mark to zero level, it does not disturb the indexes.
Thx,
SriDHAR
Re: What Hapens to Index When I Truncate the source Table [message #20140 is a reply to message #20137] Wed, 01 May 2002 04:46 Go to previous messageGo to next message
Lakshmi narasimhan
Messages: 2
Registered: May 2002
Junior Member
If a table has been truncated - index also will truncate. Ie means High Water mark will be resetted.

If A table dropped, then index will dropped.

If few rows of a table deleted, the HWM will be available. If some rows inserted which has the same key like prev existing, it will use the same segment or in case of new keys, it will insert after HWM.
Re: What Hapens to Index When I Truncate the source Table [message #20157 is a reply to message #20137] Thu, 02 May 2002 10:54 Go to previous message
sridhar
Messages: 119
Registered: December 2001
Senior Member
What I meant by 'does not disturb indexes' meaning TRUNCATE does not drop them. I also said, what TRUNCATE does, "it flushes the data and resets and high water mark". Safer usage of TRUNCATE to keep the same storage would be,
TRUNCATE tableA reuse storage;
Further more on TRUNCATE,
Any enabled foreign keys pointing the table being truncated, should be disabled, otherwise TRUNCATE would fail.
I think this is pretty much enuf for this question,
Thx,
SriDHAR
Previous Topic: how to calculate size of table
Next Topic: Performance problem
Goto Forum:
  


Current Time: Sat May 04 01:02:17 CDT 2024