function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NasipuriNasipuri 

Query API result set

Hi,

 

I am trying to call Query API from a JAVA client.

 

I have set the size of batch 2000 as

 

qo.setBatchSize(2000);

binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),"QueryOptions", qo);

 

When I am firing the query like

“SELECT Id, Name FROM Opportunity “

 

The Query result returning exactly 2000 records.

 

But when I am increasing the field size in the query as below:

 

SELECT Id, Name , Amount , AccountId,  Account.OwnerId,  Account.Owner.Employee_Type__c, (SELECT UserId  FROM OpportunityTeamMembers) FROM Opportunity

 

The Query result randomly returning about 1500 or 1600 records.

 

Is this a bug of SFDC web services API?

Can anybody please help?

 

Thanks and Regards,

Dinesh Nasipuri

 

SuperfellSuperfell
BatchSize is a hint, not a gaurentee, but in this particular case, the batch size includes all the child object in your aggregate query, not just the top level objects.

Message Edited by SimonF on 08-22-2007 08:33 AM

NasipuriNasipuri

Hi Simon,

 

So there is no guaranty that I will get the 2000 record that I have set 2000 as batch size in my query result. The number of returned record depends upon the size of record.

 

Thanks and Regards,

Dinesh Nasipuri

SuperfellSuperfell
I think this is all explained in the docs, you may get less records than you asked for based on the number and types of fields you queries, related objects in SOQL-R queries count against the batch size, if you set the batch size really small, you may get more records than you asked for, 200 is generally the minimum.