We Learn Something Every Day
3.5 years at MongoDB, and I’m still learning. All consultants do. Every day. That’s part of the allure.
Sometimes, however, we learn something that counters what we thought was solid, bedrock knowledge. And it shakes us. And we can either learn from it, celebrate it, and move on — or not. I choose the former.
This week I was consulting with a customer and we were discussing ‘live’ Data Migration between MongoDB Clusters. We always advise that TTL Indexes be removed or disabled in the Source cluster before Live Migration, then added to the Destination cluster afterwards. This part still holds true.
What surprised me was when this customer said “well, we can’t do that in a live Production system because our important queries rely on that index.“
And I immediately thought to myself:
I’ve always stated, in the training courses I deliver, that TTL indexes are created like other indexes, but do not improve query speeds. And that part, my friends, is dead wrong.
Yep. Full B-Trees are created for that field, and such an index will benefit single-field queries that include that field.
So, as the first post in my series “Mea Culpa”, I’d like to:
1) Admit the mistake
2) Learn from the mistake
3) Apologize to my students
The only saving grace is that TTL Indexes aren’t often used to both expires documents and improve query performance. Nonetheless, I still feel better having gotten this off my chest.