Can we store more than 500000 items into a list in apex? I tried this and is working fine. So the limit of 50000 has been lift up? When this update was made to salesforce? any idea?
1 Answer
As per the documentation, there is no fixed limit on the size of collections now, but you are constrained by the available heap size:
There is no limit on the number of items a collection can hold. However, there is a general limit on heap size.
The previous limit was removed in the Spring '10 release, and is documented in the release notes.
-
1This update was made in the Spring 10 release I think. "Collection Limits Removed - Limits on the number of items in a collection has been removed. However, there's still a general limit on heap size" Apr 18, 2013 at 3:45
-
Does that also applies to the VF page if we are iterating over a list which consist more than 10000 items?– dogaApr 18, 2013 at 4:00
-
1As far as I know VF pages still have the smaller limit, and that'll be because the data needs to be sent back and forwards in the view state. If you need to display 1000+ records in a page you're probably not filtering / summarising very well!– Matt Lacey ♦Apr 18, 2013 at 4:43
-
2Agree if your trying bring back 1000+ records you need to review your design. Regardless, the VF docs say this, "Visualforce iteration components, such as <apex:pageBlockTable> and <apex:repeat>, are limited to a maximum of 1,000 items in the collection they iterate over." salesforce.com/us/developer/docs/pages/Content/… Apr 18, 2013 at 4:53
-
3You can have more than 1000 items in a VF page but you'll need to use the
@ReadOnly
Apex annotation and set your VF page'sreadonly
attribute totrue
. This will let you iterate over 10k records. salesforce.com/us/developer/docs/pages/Content/… Apr 18, 2013 at 8:58