Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Using Perl to clean up DBs?

by davidrw (Prior)
on Jul 13, 2005 at 19:15 UTC ( #474657=note: print w/replies, xml ) Need Help??

in reply to Using Perl to clean up DBs?

if it's just a partial truncation, you can just do it directly (no perl) from cron with the mysql cmdline utility. I don't know the syntax offhand so i'll use postgres as an example cron entry:
0 1 * * * psql -U username dbname -c "delete from yourtable where now( +) - logdate > 8"
As for how to whack logs, you might consider just dumping last week's to a temp table.. or maybe dump to disk before you delete .. depends on your needs/resources (disk space).

Also, if there needs to be more logic involved, SQL::Abstract or Class::DBI could be big assests for the task.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://474657]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2020-10-20 23:43 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (212 votes). Check out past polls.