[Dbix-class] Removing rows older than a given number of minutes ...

Bernhard Graf dbic4 at augensalat.de
Tue Jan 26 18:51:14 GMT 2010


Kiffin Gish schrieb:

> The lazy man's way out is:
> 
> use DateTime;
> use DateTime::Duration;
> 
> my @users = $rs->search({state=>$state});
> for my $user (@users) {
>     my $duration = DateTime::Duration->new(DateTime->now -
> $user->last_modified);
>     $user->delete if ($duration->seconds > $limit);
> }
> 
> Probably more generic rather than hard-coding SQL stuff.

Try this on a dataset with a million rows, please.

L8er  ;*)

Bernhard Graf



More information about the DBIx-Class mailing list