Serverless: RPUs on index search when nothing found?

Just a quick question regarding RPUs in a serverless instance.

Say I run a findOne() against a collection, performing an index scan, and no documents are found. How many RPUs are consumed?

Thanks!

Hi @Jared_Lindsay1,

Say I run a findOne() against a collection, performing an index scan, and no documents are found. How many RPUs are consumed?

Please find some details regarding the RPU calculation mentioned within the docs on my reply in the How many RPU MongoDB Atlas uses to find random records using aggregate? post.

For testing purposes only, I performed some test runs using findOne() and recorded how many RPU’s were generated in the case that an index is used for both:

  • For a single document to be returned (First spike in RPU shown in the diagram below)
  • No document(s) being returned (Second spike in RPU shown in the diagram below)

RPU metrics for the above 2 findOne() commands:

Both values are shown at ~0.03/s (RPU). The secondary spike appears to be relatively smaller although very similar and both were rounded to 0.03/s in the metrics view when hovering the mouse over the peaks of each.

For comparison, I performed findOne() on the same collection using a field that did not contain an index in which no documents were returned (no documents matching the query) - This generated ~5.49K/s RPU.

Please note that our results may vary as the document size and index sizes between our environments will most likely vary. In saying so, it is highly recommend you test the operations on your own cluster to get a general idea of how much RPU’s are generated.

Regards,
Jason

2 Likes

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