function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SuperdomeSuperdome 

How to count total number of records in which the object(table) size is larger than 50,000?

Is there any system method can count the total number of records of the specific object ? (for example: schema.*).

 

Or, how to do it with salesforce apex code to count the number of records in which the object(table) size is over 50,000 ?

 

Integer count = [ SELECT count() FROM Object__c ];

Use count() in the way will return error: Too many query rows: 50001

 

-----------------------------

 

Have done some research and there seems no way to do it easily... :-(

Best Answer chosen by Admin (Salesforce Developers) 
Satish_SFDCSatish_SFDC
Unfortunately there is no easy way to do this.

If you just want to know the record count of the object you can check the 'Storage Usage' Link under 'Data Management'. But there is no programmatic way to get the numbers.

You can get the page reference and then scrape the data from the page but that would be too much risk.

Regards,
Satish Kumar