skip to Main Content

After deleting many documents in my DocumentDB database, I reduced my collection to a size of 2.7GB but storageSize remains at 11GB. Is there any way to free up this space?

In the WiredTiger implementation for MongoDB, there’s a "compact" command. But when run on DocumentDB this produces: "errmsg" : "Feature not supported: compact"

Even after deletion my freeable memory did not increase. I would have expected the cached documents to take up less space. It seems like all 11GB are still cached.

2

Answers


  1. Amazon states this is expected ($$) behavior. From their documentation:

    storage costs are based on the storage "high water mark" (the maximum amount that was allocated for the Amazon DocumentDB cluster at any point in time)

    To resolve you need to use MongoDB tooling into a brand new cluster:

    If removing data from an Amazon DocumentDB cluster results in a substantial amount of allocated but unused space, resetting the high water mark requires doing a logical data dump and restore to a new cluster, using a tool such as mongodump or mongorestore. Creating and restoring a snapshot does not reduce the allocated storage because the physical layout of the underlying storage remains the same in the restored snapshot.

    Login or Signup to reply.
  2. According to latest official doc :

    Starting with Amazon DocumentDB 4.0, when data is removed, such as by dropping a collection or index, the overall allocated space decreases by a comparable amount. Thus, you can reduce storage charges by deleting collections, indexes, and databases that you no longer need. With Amazon DocumentDB 3.6, when data is removed, such as by dropping a collection or index, the overall allocated space remains the same. The free space is reused automatically when the data volume increases in the future.

    DocumentDB 4.0 will compact the space automatically, as for 3.6 will keep a high water mark.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search