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
AnjaneyluAnjaneylu 

Limited number of Records from the Custom Settings

Hi all, 
I want to get the limited number of records from the custom settings..
How it is possible.. ?

Please help me.

Thanks and Regards
Anji reddy K
Arunkumar RArunkumar R
Hi Anji,

    You can query the custom setting records similar to accessing object record and use the limit attribute.
salesforce mesalesforce me
Hi Anji...

There does not seem to be a limit indicated in https://login.salesforce.com/help/doc/en/limits.htm

But of course, there has to be a limit of some kind. EG: Could 250 million records be stored in a single salesforce.com custom object?

As far as I'm aware the only limit is your data storage, you can see what you've used by going to Setup -> Administration Setup -> Data Management -> Storage Usage.

In one of the Orgs I work with I can see one object has almost 2GB of data for just under a million records, and this accounts for a little over a third of the storage available. Your storage space depends on your Salesforce Edition and number of users.

I've seen the performance issue as well, though after about 1-2M records the performance hit appears magically to plateau, or at least it didn't appear to significantly slow down between 1M and 10M. I wonder if orgs are tier-tuned based on volume... :/

But regardless of this, there are other challenges which make it less than ideal for big data. Even though they've increased the SOQL governor limit to permit up to 50 million records to be retrieved in one call, you're still strapped with a 200,000 line execution limit in Apex and a 10K DML limit (per execution thread). These can be bypassed through Batch Apex, yet this has limitations as well. You can only execute 250K batches in 24 hours and only have 5 batches running at any given time.

So... the moral of the story seems to be that even if you managed to get a billion records into a custom object, you really can't do much with the data at that scale anyway. Therefore, it's effectively not the right tool for that job in its current state.

                                             
                                              OR

http://blog.jeffdouglas.com/2010/01/07/using-list-custom-settings-in-salesforce-com/
AnjaneyluAnjaneylu
Thanks Arun kumar and Salesforce Me for your reply,
Here my requirement is to get only certain limited number of Records from the custom Settings . by using instance methods.
and without using query i need to extract.

Thanks
Anji reddy K
Amit K AAmit K A
HI anji ,

there is no limit keyword for custom setting.

but you can do one thing for getting the limited record.either you fetch record by passing specific username or profile in instance methods.
 
AnjaneyluAnjaneylu
Thanks Amit ,
If you don't mind  can you provide me the code snippest ...
thanks 
Anji reddy K
Arunkumar RArunkumar R
Hi Anji,

You can query and use limit like below,

List<customsetting__c> cs = [Select id from customsetting__c limit 2];