3 ms·
Another option is to add an "archive" table, where deleted records are moved to that table. It can get complex (for example foreign keys need special handling)
by ars 7y ago
Another option is to add an "archive" table, where deleted records are moved to that table.
It can get complex (for example foreign keys need special handling).
One option is table partitioning: https://www.2ndquadrant.com/en/blog/postgresql-12-foreign-keys-and-partitioned-tables/ https://www.2ndquadrant.com/en/blog/postgresql-12-foreign-ke...
You partition the table based on deleted or not, and then query either both tables together, or just the active table.
- jackcosgrove 7y agoPartitioning sounds like a great solution, thank you for this.