Almost all applications need to mark as delete some entities in the datastore. Depending on the business logic, these entities can be physically deleted, or just 'soft deleted' as described.
An obvious way to go with this in google datastore is having an indexed property which stores the soft delete information. For example:
Post
- Title
- Body
- IsDeleted
The problem with this method is that, in order to keep track of a very small number of soft deleted entities, all of them must put up with the overhead of an extra index.
What are some strategies to avoid the index when the soft deleted entities are very small?
One approach I can think of is to change the entity kind, say from Post to DeletedPost, which involves physically deleting the old entity and creating a new one.