Hi guys,
I've a question for someone more skilled than me
I'm looking for a way to archive old call logs without deleting them, I've found ADMIN_archive_log_tables.pl script and the related cron that does a lot of things, but I'm not sure that _archive tables works like I think, there something strange too in the script (for me). I suppose that when live tables becomes too big, records need to be moved to _archive tables and stored to read them in reports for a long time. Checking the code I've noticed that _archive tables are trimmed too. Why? They are used just to run reports on differents tables?
I'm talking abount the 4th query in the following sequence trims the call_log_archive table (ADMIN_archive_log_tables.pl file)
1) INSERT IGNORE INTO call_log_archive SELECT * from call_log;
2) DELETE FROM call_log WHERE start_time < '$del_time'
3) optimize table call_log
4) DELETE from call_log_archive where channel LIKE 'Local/9%' and extension not IN('8365','8366','8367','8368','8369','8370','8371','8372','8373','8374') and caller_code LIKE 'V%' and length_in_sec < 75 and start_time < '$del_time'
5) optimize table call_log_archive
then if I run /usr/share/astguiclient/ADMIN_archive_log_tables.pl -months=6 this will delete records older that 6 months from call_log and that is fine, but what appens in call_log_archive? It will contains less records than call_log due due to where conditions?
I can just remove the second delete and reach my goal, but I want to learn more, more, more, then I hope someone will help me
Thanks