4 ms·
Do you have any documentation about how tries are used in mongo indexes? Or could you point to the source?
by rockwotj 4y ago
Do you have any documentation about how tries are used in mongo indexes? Or could you point to the source?
- petethepig 4y agoThere's not much about it online. They do mention it in the docs, they call this "prefix compression" [0], so you can search for that. This article describes it [1], although it is somewhat high level. They only use this for indexes. It works really well for internal mongo ids (they all start with timestamps if I remember correctly). It also works well for compound indexes. Pro tip: for compound indexes always go from low-cardinality attribute to high-cardinality attribute to get the best results from prefix compression (it's also good for speed of queries). [0] https://www.mongodb.com/docs/manual/reference/glossary/#std-term-prefix-compression https://www.mongodb.com/docs/manual/reference/glossary/#std-... [1] https://medium.com/swlh/mongodb-indexes-deep-dive-understanding-indexes-9bcec6ed7aa6 https://medium.com/swlh/mongodb-indexes-deep-dive-understand...