4 ms·
One thing that I could find in the article: performance. At least for our use case, soft deletes made everything slower because it's much harder to index. For
by rubyist5eva 4y ago
One thing that I could find in the article: performance.
At least for our use case, soft deletes made everything slower because it's much harder to index. For our database we basically had to do an audit of all of our WHERE clauses and create partial indexes on "not yet deleted" records. Of course, this bloats your indexes/disk and hurts write performance so it's not a silver bullet.
We've also taken to inserting into "delete records tables" for records we may want to recover or for historical reasons. You still lose foreign keys but indexing and query optimization is a lot easier, and your old data is just still a simple query away.