Remix.run Logo
cj 7 hours ago

We deal with soft delete in a Mongo app with hundreds of millions of records by simply moving the objects to a separate collection (table) separate from the “not deleted” data.

This works well especially in cases where you don’t want to waste CPU/memory scanning soft deleted records every time you do a lookup.

And avoids situations where app/backend logic forgets to apply the “deleted: false” filter.

vjvjvjvjghv 7 hours ago | parent [-]

I guess that works well with NoSQL. In a relational database it gets harder to move record out if they have relationships with other tables.

tempest_ 7 hours ago | parent [-]

Eh you could implement this pretty simply with postgres table partitions

buchanae 7 hours ago | parent [-]

Ah, that's an interesting idea! I had never considered using partitions. I might write a followup post with these new ideas.

tempest_ 7 hours ago | parent [-]

There are a bunch of caveats around primary keys and uniqueness but I suspect it could be made to work depending on your data model.