The db tries to understand what padding for a document should be so that it doesnt have to migrate a document too many times.
When a document receive pushes it may grow significantly and drive the padding factor up.
Often times the document will eventually stop growing (no more commenting, or dialog is closed) and the document is left with a hefty padding that is wasted storage.
It would not be surprising if for such a system about 30% of storage is wasted, which also means about 30% of RAM wasted due to page mapping.
A very easy update operator to add would be $archive and could be use like:
Where N is the percentage of acceptable wasted space.
- If the wasted space is lower than N, the doc would stay where it is.
- if greater than N, the doc would be moved to a new slot on disk with minimum padding possible.
The application knows exactly when a document is "done" and can call the operator on it.
This represents very little code change since we already have the migration code done.