Am getting a time limit exceeded error when am trying to pull a set of records through database.getquerylocator and binding it to vf page (jqgrid).

I have about 80000 records but am limiting it to 10000 though. Am calling this from a JQGrid. Everytime i click next its just fetching 100 records by passing the pagesize to the standard set controller.

Apart from that am using a count query to display the count on the top of my page.. not sure why its throwing this error..

Can someone help here?

Iam also getting a weird error 'Response size exceeded 30MB organization limit'. Not sure why ? :(

Here is the link to my other post which has the code :-

How to query more than 50000 records in apex and bind it in vf page in jqgrid and paging?

Just now looked through salesforce forums and I got link which shows the same issue as mine.. (except that its showing some salesforce page but am using visualforce page). There is no proper solution give though.

Here is the image

enter image description here

and here is the url :-


and i am embedding only visualforce components inside my page, and not embedding some other visualforce page itself.

*********** Description updated on last edit ************

After doing a lot of debugging, i found the problem... This is my situation :- 1. I have to query info from an object called Assets and I have to check if that asset exists in 2 different objects say customerasset and customergroup.

customerasset object holds the information about if the customer has access to that asset &

customergroup object holds information about if the customer has access to a group to which the asset belongs to..

Unfortunately for customerasset we have around 12000+ records for a customer

and there are around 100 groups which the user has access to and each of the group can contain some 100 assets.

So if i try to get the set and set using 2 sepearate queries. and in the third query if i give like this :- select id,name from asset where id in: assetidset or groupid in : groupidset This is taking so much time (10 minutes. screenshot below) as the assetidset has about 12000 assets.

enter image description here

But if i substitue my query directly in place of assetidset its throwing error saying semijoin subselects not allowed.

I tried removing my or condition, its loading quickly. But can someone help me to filter the asset based groupid set as well through an OR condition so that assets are returned if it is present either in assetidset or if the asset's group is present in the groupidset.

I cant create two separate queries because i have to do paging and sorting in my jqgrid using standardsetcontroller of database.getquerylocator.

*********** Description updated on last edit ************

  • 2
    post some code.
    – superfell
    Aug 28, 2012 at 4:15
  • 2
    That's probably the view state limit. Try disabling Show View State in Development Mode on your user record. Aug 28, 2012 at 5:07
  • added link to my code @superfell
    – Sathya
    Aug 28, 2012 at 8:56
  • 1
    I see you have answered your own q on SF forums, do you mind doing the same here?
    – Saariko
    Sep 24, 2012 at 7:59

1 Answer 1


Time limit exceeded will come generally if the external API not responding with in the time specified by salesforce ... Here the resolution is replacing the JQgrid is one but its too complicated for your work..... otherwise make use of salesforce components to get that table....

Once again getting the response is also u need to make control...request and response should be concise. or u can make use of JSON apart from sending obect straight away....

  • hey kiran thanks for your response, but i have used JQGrid everywhere in my application, so as you say its tough for me to remove that and whenever JQGrid hits the URL, its just returning the json response and not the object itself. FYI I have also edited my post and added the link which has my code
    – Sathya
    Aug 28, 2012 at 8:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .