+ Start a Discussion
mayank_friend52mayank_friend52 

What is the maximum no of records we can get through query from AJAX ?

Hello,

I am using query in Ajax to get records from Standard as well as Custom Objects. What is the maximum of records I can get through this.
I know that Apex Governor limits : 50000 rows at max .

But when  I am query through Ajax, i get more than 50,000 records (rows).
How is this possible.

My Code is as :
------------------------------------------------------------------------------------------------------------------

var exeQuery="Select id from Contact" ;

sforce.connection.query(exeQuery);

----------------------------------------------------------------------------------------------------------
vmanumachu1.393650924860069E12vmanumachu1.393650924860069E12
Its 2000 records.
Vamsi KrishnaVamsi Krishna
Mayank,
sforce.connection.query has different limits compared to your normal SOQL queries in APEX..

The query result object contains up to 500 rows of data by default. If the query results exceed 500 rows, then the client application uses the queryMore() call and a server-side cursor to retrieve additional rows in 500-row chunks. You can increase the default size up to 2,000 in the QueryOptions header.

reference:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_query.htm
mayank_friend52mayank_friend52
Hello,

Thanks Vamsi for your response.

But i am getting more than 100,000 records, while according to Apex Limits, Total number of records retrieved by SOQL query is only 50,000 records. 
Could you please explain me this difference.

My Code is as :
------------------------------------------------------------------------------------------------------------------

var exeQuery="Select id from Contact" ;

sforce.connection.query(exeQuery);

----------------------------------------------------------------------------------------------------------


Thanks,