I have 2 models in my cakePHP app - let's say ParentModel and ChildModel. They have hasMany association. The parent db table contains about 4000 records, but the child table about 90000 records. I want to delete related datas from tables by using this:
$this->ParentModel->deleteAll(array('ParentMode.somefield' => 'x'));
Works well when a small amount of records matching 'x', but when parent table matches like 1000 records which have about 20000 child records in total, it gets really slow. Basically it just loads for 30 sec and then times out. Is there any way how to speed this up? I suppose this is not so large amount of data after all.