As I am not a coder so I should stop here but I am interested how far I could go to build an automatic SQL script.
Case: A website is hosted on a shared host server which uses CPanel. The website use only one DB and one of the table is the log. Now the log table has reached 300k rows... (I might do something wrong here... it is a popular website?:))
So I need to reduce the log table but I would like to do a backup rather. So here is my idea:
Setup a backup DB and copy the old entries meanwhile use tables for only quarter years so the log from Jan-April would be stored in table_2012-q1 etc.
I would like to use cron and email alert.
- is there any better and easier solution to do the back up with this row num.
- if I do a "move rows" by INSERT/DELETE rows how can I check which one is ready on time?
- do I need to focus on the performance of this process as it should work in the background? In other words is it a select or a dump?
Sorry if it is too Dummy but I would like to learn! I also don't want to use too much processor for this.
preguntado el 31 de julio de 12 a las 14:07
Since you are using shared hosting, I'm pretty sure you will not be able to access cron, so here is an alternative:
Since the database is filled with log data :
1. Create a new table, regardless of the name or time period 2. Move the files (from a certain id) from one table to the next
This link will explain better : base de datos parcial mysqldump
If this is active DB, I would clone it and then play around with the ways the data will be moved since you do not consider youreself a coder.
Espero que esto ayude.