The delete method is rather inefficient. When called, Class::DBI will issue one DELETE statement for each row in your table. Instead of producingThis is where I got my info from. The suggestion is obviously that Class::DBI will issue a series of deletes inefficiently over-riding the ON DELETE constraint. I haven't tried it yet, but from my reading you are correct about the INSERT and UPDATE constraints.It doesDELETE FROM page WHERE user_id = 1 DELETE FROM user WHERE user_id = 1which can be quite long for large data sets. The sad thing is that, even if I use a database that enforces referential integrity, Class::DBI will still override the database features and issue the same DELETE statements. In your example, if you replace the table definition to use the InnoDB table type, addingDELETE FROM page WHERE page_id = '1' DELETE FROM page WHERE page_id = '2' DELETE FROM page WHERE page_id = '3' DELETE FROM page WHERE page_id = '4' DELETE FROM page WHERE page_id = '5' DELETE FROM user WHERE user_id = '1'You can then get the same behavior withFOREIGN KEY (user_id) references user (user_id) ON DELETE CASCADE, KEY user_id (user_id) # and replace "MyISAM" with "InnoDB" for both tablesand the database engine will take care of cascade deletiing the appropriate records in "page".%dbh->do("DELETE FROM user WHERE user_id=1")
I would value your comments on the DELETE case as well!
jdtoronto
PS Do you know of any examples I could look at of multi-table JOIN's in Class::DBI? ..j
In reply to Re: Re: Class::DBI with MySQL INNODB tables
by jdtoronto
in thread Class::DBI with MySQL INNODB tables
by jdtoronto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |