Hacker News new | ask | show | jobs
by EdSchouten 756 days ago
Out of curiosity, would placing all DELETE queries within a single transaction also help? Or does that still cause PostgreSQL to process each of the queries sequentially?
2 comments

No — most constraint checks are by default deferred until the end of the transaction, but you'd still need to check them, and without an index you'll still have to do a large scan.

See https://www.postgresql.org/docs/17/sql-set-constraints.html for more information regarding constraint checking.

seperate queries within a transaction aren't optimized together. It wouldn't help (apart from possibly some caching benefits).