Is cascade delete on a table more efficient than individual delete statements (executed in a single plsql block) ?
Is cascade delete on a table more efficient than individual delete statements (executed in
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What
cascade deletedoes is issue individual delete statements.Examine the following test case:
In the trace file, you will find a line like this:
That is Oracle issuing a delete statement against
CHILDfor each record it’s deleting inPARENT.A different question would be which of the two are more efficient:
vs
both with
on delete cascadeenabled. Suprisingly enough, in the first case above, Oracle will probe the foreign key index on the child table to see if any rows exist which would require a cascade. If no rows exist, Oracle does not execute the cascaded delete.