optimize -> analyze
while cleaning up logs use temporary table