Faster remove product analytics events in batches
Right now we use
dependent: :destroy because it allows deleting objects in batches. However destroy can be slow so we better implement specific solution for this case.
It can be done through a CTE: WITH cte as (SELECT id from table ... limit 1000) DELETE FROM table where id IN (select id from cte)