Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>TTL is good and all however repair is not. <code>--repair</code> is not designed to be run regularly on a database, infact maybe once every 3 months or something. It does a lot of internal stuff that, if run often, will seriously damage your servers performance.</p> <p>Now about reuse of disk space in such an envirionemt; when you delete a record it will free that "block". If another document fits into that "block" it will reuse that space otherwise it will actually create a new extent, meaning a new "block" a.k.a more space.</p> <p>So if you want save disk space here you will need to make sure that documents do not exceed each other, fortunately you have a relatively static schema here of maybe:</p> <pre><code>{ _id: {}, token: {}, user_id: {}, device: {}, user_agent: "" } </code></pre> <p>which should mean that documents, hopefully, will reuse their space.</p> <p>Now you come to a tricky part if they do not. MongoDB will not automatically give back free space per collection (but does per database since that is the same as deleting the files) so you have to run <code>--repair</code> on the database or <code>compact()</code> on the collection to actually get your space back.</p> <p>That being said, I believe your documents will be of relative size to each other so I am unsure if you will see a problem here but you could also try: <a href="http://www.mongodb.org/display/DOCS/Padding+Factor#PaddingFactor-usePowerOf2Sizes" rel="nofollow">http://www.mongodb.org/display/DOCS/Padding+Factor#PaddingFactor-usePowerOf2Sizes</a> for a collection that will frequently have inserts and deletes, it should help the performance on that front.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload