The above index definitions are correct. In both cases this is actually what we want. However, you need to be aware that fanout indexes are typically more expensive than regular ones.
RavenDB has to index many more entries than usual. What can result is higher utilization of CPU and memory, and overall declining performance of the index.
Starting from version 4.0, the fanout indexes won't error when the number of index entries created from a single document exceeds the configured limit. The configuration options from 3.x:
are no longer valid.
RavenDB will give you a performance hint regarding high fanout ratio using the Studio's notification center.
Once RavenDB notices that the number of indexing outputs created from a document is high, the notification that will appear in the Studio:
High indexing fanout ratio notification
The details will give you the following info:
Fanout index, performance hint details
You can control when a performance hint should be created using the PerformanceHints.Indexing.MaxIndexOutputsPerDocument setting (default: 1024).
Since the fanout index creates multiple entries for a single document and queries return documents by default (it can change if the query defines the projection) the paging of query results
is a bit more complex. Please read the dedicated article about paging through tampered results.