patternMinor
WiredTiger prefix compression for index on MongoDB
Viewed 0 times
compressionmongodbforprefixindexwiredtiger
Problem
According to the MongoDB documentation (at least this blog entry https://www.mongodb.com/blog/post/new-compression-options-mongodb-30), prefix compression is enabled by default on MongoDB.
However, when I look at one collection, I see this:
Does
However, when I look at one collection, I see this:
db.myCollection.stats()
{
...,
"wiredTiger" : {
"metadata" : {
"formatVersion" : 1
},
"creationString" : "...,prefix_compression=0,prefix_compression_min=4"
...
}Does
prefix_compression=0 means that my indexes are not prefix-compressed ?Solution
By default collection stats only include information on the collection data (which uses block-level compression rather than prefix compression).
To see index details you need to provide an additional
You should see "prefix_compression=true" in the index
To see index details you need to provide an additional
indexDetails option, eg:db.myCollection.stats({indexDetails:true}).indexDetails._id_.creationStringYou should see "prefix_compression=true" in the index
creationString value.Code Snippets
db.myCollection.stats({indexDetails:true}).indexDetails._id_.creationStringContext
StackExchange Database Administrators Q#176101, answer score: 3
Revisions (0)
No revisions yet.