I have created Restful Resource (Http Get API) to fetch the data from Salesforce. I have more than 9 Lac records in my custom object which I need to send via API. I have implemented the Max Row and Offset to overcome the Governor Limits. Now the problem I am facing is I need to send the total record count with the response.
For Ex. User calls the API with maxLimit as 5000 records, API will return 5000 records but there are more records for the same criteria and hence I need to send the total count for that. I know I can do the Count() query to find the total number but if the total records are more than 50000 than it will give error "System.LimitException: Too many query rows: 50001".
Any Idea for this? Thanks