Since you're just emptying the table, why not just set all rows post_revision_count = 0? Saves the earlier select query and would prevent sync issues