Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Delete with Cascade
Delete with Cascade [message #2632] Tue, 23 November 2010 08:30 Go to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
I have a couple of tables which have a master/detail relationship and delete integrity set to cascade. I've noticed that if I delete a master record (from a LIST screen) the delete operation can take a long time and even occasionally times out. Typically, there may be 200 - 250 detail rows related to the master row (so not huge numbers).

As far as I know my indexes are all set correctly. Is the performance possibly related to the frameowrk iterating each detail row and deleting it separately?

If so would a better solution be for me to remove the cascade option and manually delete the details rows on deletion of a master row in a single transaction?

Thanks,

Graham
Re: Delete with Cascade [message #2633 is a reply to message #2632] Wed, 24 November 2010 13:57 Go to previous message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
Yes. Each child record is read individually so that the deleteRecord() method can be called to deal with any grandchildren (and great-grandchildren, et cetera). If you have audit logging turned on then eah deleted record is also written to the log file.

If you want to turn logging off for deletes you can set $this->audit_logging to FALSE in the _cm_pre_deleteRecord() method an back to TRUE in the _cm_post_deleteRecord() method.

If you want to delete all children and ignore the possibilty of grandchildren you can insert code in the _cm_pre_deleteRecord() method to cycle through the array of child tables and perform a deleteSelection() on each one. This will then delete any child records on that table without having to read them first.


Previous Topic: add another action button to enquire form
Next Topic: grandparent - parent - child link entity
Goto Forum:
  


Current Time: Fri Mar 29 05:50:40 EDT 2024

Total time taken to generate the page: 0.00938 seconds