The only scalable delete in Postgres is DROP TABLE

Large DELETE operations in Postgres can be inefficient due to added write and replication overhead, and not freeing up physical disk space immediately. Instead, consider schema designs that allow for DROP TABLE or TRUNCATE operations. This is because DELETE operations add work to the database, and don't immediately free up space. It's recommended to use these alternative methods for large-scale row cleanup. This is due to Postgres' implementation of MVCC, which stores modified and deleted rows alongside current ones, and the need for full replication of deletes.

Source →
FeedLens — Signal over noise Last 7 days