Search code examples
oracleoracle11gdatamart

Oracle - Delete One Row in Dimension Table is Slow


I have a datamart with 5 dimension table and a fact table. I'm trying to clean a dimension table that has few rows (4000 rows). But, the fact table have millions rows (25GB)(Indexes and partitions).

When I try to delete a row in the table dimension, the process becomes very slow. It's just as slow despite the absence of relationship with a row in the fact table (cascade delete).

Is there any way to optimize this?. Thanks in advance.


Solution

  • Presumably, there is a cascading delete of some sort between the dimension table and the fact table.

    Adding an index on the key column in the fact table may be sufficient. Then Oracle can immediately tell if/where any given value is.

    If that doesn't work, drop the foreign key constraint altogether. Delete the unused values and add the constraint back in.