RE: ON DELETE CASCADE causing problems

From: Igor Neyman <ineyman_at_perceptron.com>
Date: Wed, 9 Jul 2008 15:28:39 -0400
Message-ID: <F4C27E77F7A33E4CA98C19A9DC6722A2032D8DBC@EXCHANGE.corp.perceptron.com>


This design is fine.
"on delete cascade" is the right way to do it (instead of doing it
through application code).  

As for performance - do you have indexes for your FKs?  

Igor


From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of sol beach Sent: Wednesday, July 09, 2008 2:12 PM
To: Oracle-L
Subject: ON DELETE CASCADE causing problems

Oracle V10.2 on RHAS4

I am supporting an custom, inhouse application which has many FKs; which utilize ON DELETE CASCADE capability. Typically the database very low (1-3) active sessions. The following SQL results in the database tying itself into knots. DELETE FROM USERPROFILE WHERE ORG_ID IN ( Select ont.orgnodeId from OrgNode ont where ont.fullyQualifiedName like '/SOME/RANDOM/PREFIX/%');
The USERPROFILE table has 3 FK with ON DELETE CASCADE. Two of these tables have at least 1FK with ON DELETE CASCADE. These 2 tables have at least 1FK with ON DELETE CASCADE each; one of which points back to USERPROFILE. When the DELETE above is invoked, the number of active sessions soars to 40 & the DELETE took 5239 seconds to complete. SELECT statements continued to work, but many DML statements
"hung" while this hairball got digested.

Needless to say, folks were not pleased. Even though I had no part of designed this "capability", I have been tasked with reducing the impact across the application.

Which VIEW & COLUMN indicates the "ON DELETE CASCADE" exists?

What would be the SQL that reports all tables impacted by the DELETE statement above?

Any & all suggestions are welcomed.

Thanks In Advance

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Jul 09 2008 - 14:28:39 CDT

Original text of this message