Database · Hard
Delete millions of rows in batches without locking the table.
DatabaseSQL QueriesStaff
Answer preview
Never delete millions of rows in one statement — chunk it, so each transaction is short, the locks are released between batches, and autovacuum can keep up.…