[SalesForce] Time limit exceeded and ‘Response size exceeded 30MB organization limit’ and Semi-join subselects not allowed

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 :-

http://boards.developerforce.com/t5/Visualforce-Development/What-is-going-on-with-Visualforce-performance/m-p/169466#M21299

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 ************

Best Answer

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....