How to load charts faster, do indexes help?


I am trying to display a table chart on a collection with 101.7k documents in it. When I disable ‘sample mode’ to render all chart data, the chart is taking couple of minutes to load. I’ve tried adding indexes on fields being used in the chart but I see on difference in chart rendering time. Are there any ways to reduce the chart rendering time ?

Thank you.

Hi @pickelrick26 -

Indexes do help in Charts, but only if your chart contains filters. If the filtered fields are indexed, MongoDB is way more efficient at finding the matching documents. If you are not using filters on your charts, indexes won’t help at all.

100K documents is likely more than a human is every going to look through. I suspect the best thing to do here would be to limit the number of documents returned. Right now there’s no Limit Results option on table charts (it’s coming soon), but you can do this yourself by entering a pipeline in the query bar with a $sort and $limit stage.


1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.