RetrieveTotalRecordCountRequest to get the total record counts instead of navigating through pages 🙂
Also check –Different ways of getting record count (total) in Dynamics 365
https://nishantrana.me/2020/05/27/different-ways-of-getting-record-count-total-in-dynamics-365/
Dreaming in CRM & Power Platform
There are couple of ways to gets entity record counts: you could use XrmToolBox’s Record Counter Tool, or write the FetchXml to count the records as you navigate from one page to the next. But, if you just want to use the SDK here is a simple method: a new message called RetrieveTotalRecordCountRequest. Here is how to use it in C#:
Here is the same call in JavaScript:
Hope this is useful.
Reference: