Right now we select from the metrics_writes into a temporary table.
Does "select for update" make a difference?
Should we mark the rows for deletion instead of deleting them, then drop them with a separated job?
Would it be interesting to use a table that is partitioned by time so that we can work only on the last set of rows, and drop entire partitions altogether when cleaning up?