It depends.

It depends on the cardinality of each field values. It depends if the fields value are muted once the documents are created.

Some of the facts are

  1. There is one file per index, 1 compound index means 1 file, 4 separate indexes means 4 files.
  2. The order of the fields in the query are not important but the order of the fields in a compound index are important. See the ESR rule.
  3. If your query involves a field that is not in the best index for the query, then the document will have to be fetched.

But if your most frequent query always involves the 4 fields with equality, the I am pretty confident that the compound index will perform better most of the time.

1 Like