unoptimized queries in mysql stats generating