SQL: inspect data older than a cutoff
A sql example about delete old data.
Original retention-query example. The placeholder uses named parameter syntax; adapt binding to your database driver. This example previews rows and does not delete data.
-- Bind :cutoff as a timestamp using your database client. SELECT id, created_at FROM events WHERE created_at < :cutoff ORDER BY created_at LIMIT 100; -- Archive or delete only after reviewing retention requirements. -- Use bounded batches, a backup and an explicit transaction.