43

After dropping the table, found that the index created on the columns of the dropped table is gone. I just want to know what happens after that. Could someone please explain?

What all are the others getting dropped along with table drop?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Vaandu
  • 4,857
  • 12
  • 49
  • 75

4 Answers4

53

In Oracle when dropping a table

  • all table indexes and domain indexes are dropped
  • any triggers defined on the table are dropped
  • if table is partitioned, any corresponding local index partitions are dropped
  • if the table is a base table for a view or if it is referenced in a stored procedure, function, or package, then these dependent objects are invalidated but not dropped
Raihan
  • 10,095
  • 5
  • 27
  • 45
16

In Postgres

DROP TABLE always removes -
1. any indexes
2. rules
3. triggers
4. constraints
that exist for the target table. 
Atty
  • 691
  • 13
  • 20
11

MySQL also drops table indexes when tables are dropped.

For more info, see Does dropping a table in MySQL also drop the indexes?

Community
  • 1
  • 1
Magnus H
  • 111
  • 1
  • 5
11

By default, MS Sql Server also drops indexes when a table is dropped. (Observed in version 13.0.4206.0.)

Merijn Vogel
  • 196
  • 2
  • 7