From: =?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= Subject: [CDBI] Do cascading deletes faster Date: 03:11 on 05 Feb 2006
Hi,
Two tables: "servers" and "log_scores". Sometimes there are tens of
thousands of log_scores per server. When I delete a server I'd like
to make it go faster, so I naively added a before_delete trigger like
__PACKAGE__->add_trigger(before_delete =>
sub { NTPPool::Server::LogScore-
>delete_server($_[0]) }
);
(delete_server then does a simple $dbh->do to delete all the servers
without loading them etc).
This would be okay for me because there isn't anything cascading from
the LogScore class (and no triggers or some such).
It doesn't work though. I didn't look closely, but it seems like
Class::DBI still does the cascading deletes (or at least the select)
first.
I solved it by just adding { cascade => 'None' } to the has_many(),
but it seems like it should have worked the other way.
The code is at
https://svn.develooper.com/projects/ntppool/trunk/lib/NTPPool/Server.pmhttps://svn.develooper.com/projects/ntppool/trunk/lib/NTPPool/Server/
LogScore.pm
- ask
-- http://www.askbjoernhansen.com/
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
[CDBI] Do cascading deletes faster
=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= 03:11 on 05 Feb 2006