Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Using Perl to clean up DBs?

by davidrw (Prior)
on Jul 13, 2005 at 19:15 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-18 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found