0
  1. How many records can be displayed in a Visualforce Page?
  2. Is it possible for 50000-100000 in single page?
4
  • Try to use ReadOnly and RemoteAction annotations, if you have no DML to perform on vf page which is just for display or read. However you need to use pagination concept and transient keywords developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/… – Salesforce Learner Oct 17 '16 at 15:44
  • 1
    Why would you ever want to do that? – Adrian Larson Oct 17 '16 at 15:51
  • 1
    Welcome to SFSE! Please take some time to look over the articles in the help center, especially how do I ask a good question?. As is, your question isn't terribly specific (and it may get closed for that reason). Generally speaking, providing more details will mean that you'll get better quality answers. For example, it would help if you explained why you want to display so many records. – Derek F Oct 17 '16 at 15:52
  • 1
    It also doesn't look like you've done any research. This sounds like it would be easy information to find with a basic google search. For that reason, I've downvoted your question. – Derek F Oct 17 '16 at 15:53
2

There are several limitations that come into play here.

  1. The component that you'd be using to display all of these records, <apex:repeat>, <apex:pageBlockTable>, or <apex:dataTable> can only accept up to 1000 rows of data
  2. You need to consider how the number of records affects the size of the visualforce viewstate. The viewstate has a limit of 135kb, which you'd most certainly hit if <apex:repeat> and the like could accept more than 1000 rows
  3. If the first two items weren't an issue, you can normally query up to 50,000 records in a single go. There are ways to work around this, but 50,000 records is already impractical to display
  4. It isn't a system limit, but if none of the 3 points above were issues, loading so many records onto a single page would be extremely slow

If you absolutely need to display so many records, you'll need to turn to pagination. You can use an ApexPages.StandardSetController to help out with this. Jeff Douglas has a good demo of how to accomplish this.

At any rate, I'd seriously consider taking a closer look at why you think you need to display so many records, and try to find a way to reduce the number of records somehow.

2
2

From My Notes:

If you fetch directly such number of records through SOQL using ReadOnly annotation, it would take very long time that there would be a timeout related to remoteAction. Even i'm quite sure there will be timeout only after 10000 or 20000 records.So it's better to fetch couple of thousand record and use pagination for further record fetching.

It's always better to apply filters and search functionality for such cases.

Now it's not clear from your question why you want to actually fetch that many records.So it's better if you provide more details.

from comments: So it seems that you can increase the timeout of remote calls, check this link for better understanding.You can increase it upto 120 seconds but in my opinion that would also a very bad user experience so i would again stay with more filters and a better search functionality with proper pagination.

7
  • Actually it doesn't take incredibly long to load 10k records through remoting. I've definitely pulled 12k-13k without noticeable lag. – Adrian Larson Oct 17 '16 at 16:08
  • @AdrianLarson Where do you live man, is it near to the salesforce servers :D On serious note actually in my app i also had such requirement and i did retrieve contact records with an soql query from a Remote action and read only method and i faced that timeout issue. – Mr.Frodo Oct 17 '16 at 16:14
  • 1
    Huh interesting. Did you play around with the configuration at all? Using a buffer slows it down, and you can bump up the timeout to two minutes (!). – Adrian Larson Oct 17 '16 at 16:16
  • @AdrianLarson Oh dear god, where do you find such amazing things, this could have helped me at that time :( Can i add this in the answer? or you want to come with some more cool things? – Mr.Frodo Oct 17 '16 at 16:21
  • 1
    I would bet if you ran your query through the Query Plan tool, you would see a high Cost number, and that contributed to your timeout. Usually if you are filtering on indexed fields it'd pretty quick. – Adrian Larson Oct 17 '16 at 16:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.