Compound wildcard index

We currently use attribute pattern with fixed fields. With the release of Mongo 7, I’m curious if we should be looking at switching this index to compound wildcard.

Gilberto Velazquez’s talk on attribute pattern from a few years ago is excellent (https://www.youtube.com/watch?v=9eYwrloeM7U) and seems to indicate compound wildcard would be the way to go, but I’d love to know if there is any more recent data on this.

In addition to fixed fields, we also have some sort fields indexed (after the attributes). So the query pattern is (fixed fields, attributes, sort). Just mentioning that in case it changes the recommendation (I’ve actually been wondering if it would make sense to have the sort broken out into a separate index, so any pointers there would be helpful as well).

Thanks in advance for any pointers/advice/suggestions!

1 Like

Hi @Andrew_Rothbart1 and welcome to MongoDB community forums!!

The performance enhancements would purely depend on your use case and the query you are performing. With the release of 7.0, using compound wildcard indexes would help with solving the issue of creating and maintaining multiple indexes with just a single index.

The performance enhancements would purely depend on your use case and the query you are performing. > There are a few considerations to keep in mind when using wildcard indexes.

Hence the suggestion would be to use the feature if this helps in improving your performance.

Regards
Aasawari

@Andrew_Rothbart1 I was wondering did you find out any more information on this? The video does seem to state that compound wildcard indexes is the way to go for attribute pattern but was hoping for tested metrics and performance. The only place they mention using the compound wildcard index and the attribute pattern is on their docs https://www.mongodb.com/docs/manual/core/indexes/index-types/index-wildcard/index-wildcard-compound/#search-using-the-attribute-pattern.

Just hoping for some updated articles and docs on the attribute pattern. It seems there are a couple of ways of actually doing the attribute pattern but it depends on the use case. Having a general idea of which way is best would be great.