Hi Guys,
it is generally valid for any version even though now I'm trying to figure out how to tackle a problem on this version (1.9.16).

I have a strong suspicion that the activities carried out on the ticket system are leading to an uncontrolled growth of the database with some tables that seem to have data not referred to any ticket! That said here are some details.

I added a daily crontab process for cleaning tickets through this simple function:

	function delete_ticket($id) {
		$t = new Ticket ( $id );

		log_data("Deleting old ticket $id:" . $t->getSubject () . "\n");
		return $t->delete();

		return true;
	}

...something does not run in the right direction! I tried to do some queries that I think highlight this problem. Despite the cleaning procedure uses program classes & functions, much information remains orphaned:

	SELECT COUNT(A.ticket_id) FROM `vh_ticket_event` A 
	LEFT JOIN `vh_ticket`B ON A.ticket_id = B.ticket_id
	WHERE ISNULL(B.ticket_id)

return 1.105.625 records!

	SELECT COUNT(A.id) FROM `vh_ticket_email_info` A
	LEFT JOIN `vh_ticket_thread` B ON A.thread_id = B.id
	WHERE ISNULL(B.id)

return 1.654.888 records!

...this makes me think that my cleaning procedure does not run exactly as I would have expected (there are only 100,000 tickets so I do not expect to find millions of records in other tables)!

That I have to do something else? That anyway a DB control program would be useful to highlight these trivial inconsistencies! I have a database that grows and approaches to reach 100GB, I would like to check the presence and removal of orphan records. How do I proceed?

Hence, the idea of having a procedure that performs a posture on the database and proceeds to a coherent cleaning of orphan data!

Maybe something similar already exists and I have not found it :-( !?!?!?

Thanks,
Arturo.

Write a Reply...