4 ms·
PostgreSQL supports deferring constraints. https://begriffs.com/posts/2017-08-27-deferrable-sql-constraints.html https://begriffs.com/posts/2017-08-27-deferrabl
by joevandyk 7y ago
PostgreSQL supports deferring constraints. https://begriffs.com/posts/2017-08-27-deferrable-sql-constraints.html https://begriffs.com/posts/2017-08-27-deferrable-sql-constra...
- hrktb 7y agoThis looks nice, it’s still limit to a single commit though. That’s where it’s a PITA for anything that won’t (or we don’t want to) fit a single commit. In particular splitting commits allows to ingest data in parralel (for instance if we import stores and store owners, both could be ingested separately without caring at first if each references a valid entity)
- JoshuaDavid 7y agoAt least with mysql, and probably with postgres as well, you can temporarily turn off foreign key checks for a set of statements. So you can still get the benefits of foreign key constraints by default but when they do more harm than good you can turn them off. With the added benefit that turning off FK constraints screams "I am doing something unusual and dangerous - this requires extra caution."