Index prefix compression and index size
Parent: MongoDB Compound Index Design: ESR, Selectivity, Covering and Multikey Bounds · Published reference · snapshot 2026-10-22 · skill ranked-40493c90
↓ Facts as markdownall context files
Source-anchored research for Index prefix compression and index size. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
How it works
- Prefix compression trades space for CPU and memory work. WiredTiger warns that reconstructing keys has overhead and that compression may not pay when it saves only a few bytes per key or when block compression already addresses the main disk cost. (high confidence) [source]
- Prefix-compression savings depend on key similarity: Percona identifies repetitive indexes as especially likely to benefit, and a B-tree evaluation found stronger prefix-compression savings when neighboring sorted keys were more similar in its tested distributions. (high confidence) [source]
Comparisons and alternatives
- Inference from the adjacent-key encoding: compound-index field order can change which neighboring keys share prefixes. Measure the resulting index sizes with representative values and key patterns instead of assuming a fixed compression percentage. (medium confidence) [source]
Facts and statements
- MongoDB's current WiredTiger documentation and the MongoDB 9.0.4 configuration declare `storage.wiredTiger.indexConfig.prefixCompression` enabled by default for indexes (`default: true`); the setting can be disabled. (high confidence) (verified as of 2026-10-20) [source]
- WiredTiger's row-store B-tree prefix compression stores a common leading key prefix once per page; later keys retain their suffix and prefix-length metadata. WiredTiger documents that this reduces key representation size both in memory and on disk. (high confidence) [source]
- MongoDB's WiredTiger documentation says index prefix compression can reduce internal-cache RAM as well as on-disk size; Percona describes the cache benefit as strongest for repetitive indexes. Prefix compression is separate from collection block compression. (high confidence) [source]
- MongoDB's `db.collection.totalIndexSize()` and per-index `indexSizes` report compressed size for indexes that use prefix compression, so these metrics are not raw totals of uncompressed key bytes. (high confidence) (verified as of 2026-10-22) [source]
- A 2025 B-tree study implemented WiredTiger from its source code and reported lower insertion and point-search performance than an uncompressed B-tree in its in-memory test; it attributed the gap to decompression-like work. This result is a scoped implementation benchmark, not an end-to-end MongoDB workload measurement. (medium confidence) [source]
- MongoDB documents prefix compression as enabled by default for all WiredTiger indexes and provides the storage.wiredTiger.indexConfig.prefixCompression setting to disable it. (high confidence) (verified as of 2026-10-22) [source]
- A smaller prefix-compressed index does not guarantee faster queries. WiredTiger warns that random lookups and reverse cursor movement may reconstruct uncompressed keys at additional CPU and memory cost; in a paper's random-dataset memory experiment, WiredTiger compressed well but had lower throughput than Head+Tail compression, which avoided query-time decompression. (high confidence) [source]
Children
- No children recorded.