put a .count at the end of the line above where .destroy_all is.
I think you can add limit 1000 in the where clause to limit the query.
put a .count at the end of the line above where .destroy_all is.
I think you can add limit 1000 in the where clause to limit the query.