Create a savepoint before risky delete
SQL
Easy
1 views
Problem Description
Before deleting old logs, create a savepoint. If you feel too many rows got deleted, rollback to the savepoint; otherwise commit.
Constraints
Assume PostgreSQL-style interval
Official Solution
BEGIN; SAVEPOINT before_delete; DELETE FROM LoginLogs WHERE logged_at < (CURRENT_TIMESTAMP - INTERVAL '365 days'); ROLLBACK TO before_delete; COMMIT;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!