[Dbix-class] Removing rows older than a given number of
minutes ...
Kiffin Gish
kiffin.gish at planet.nl
Tue Jan 26 21:16:04 GMT 2010
On Tue, 2010-01-26 at 19:51 +0100, Bernhard Graf wrote:
> 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
Very true, but there must be better ways to do this than the reactions
so far.
More information about the DBIx-Class
mailing list