MongoDB 8.2 encrypted substring search costs 20x more per insert than equality
MongoDB 8.2 in public preview added $encStrStartsWith, $encStrEndsWith and $encStrContains operators for searching encrypted fields in Queryable Encryption. Tests showed substring search insert costs 22.9 ms per document versus 1.16 ms for equality-only encryption and 0.03 ms unencrypted, with storage growing 380 times relative to plaintext.
- Substring search insert: 22.9 ms/doc vs 1.16 ms equality and 0.03 ms unencrypted
- Storage for 500 docs: 25.3 MB vs 66.5 KB plaintext — 380x growth
- For 500 docs, ECOC collection stores 86,500 tokens — about 173 per address
- substringPreview cannot combine with other query types, only prefix and suffix together
Read next
Software