+ Start a Discussion

Batch size not working


I can't seem to change the batch size on my select calls.  Could someone make a sanity check here to make sure I haven't made a silly mistake.

I'm trying to set the batch to 25 and I keep getting back 113 records.

I'm also using compression which I doubt is the cause of anything,


Java code:

        QueryOptions qo = new QueryOptions();
        qo.setBatchSize(new Integer(25));
        binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "QueryOptions", qo);
        QueryResult selectResult = null;
        try {
            selectResult = binding.query(sql);

SOAP message:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <ns1:SessionHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="SforceService">
            <ns2:sessionId xmlns:ns2="urn:partner.soap.sforce.com">left out of posting</ns2:sessionId>
        <ns3:QueryOptions soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns3="urn:partner.soap.sforce.com">
    <soapenv:Body><query xmlns="urn:partner.soap.sforce.com">
        <queryString>Select Id, Name, ParentId from Account </queryString></query>

I read, recently, in the docs that there is a minimum batch size of 200.  Could it be that there are only 113 account records?  I, too, attempted to set the batch size to something less than 200 (100) and was given 200 records per set.  It also seems that the default batch size is 1000.
As the docs should point out, as of 7.0, batchSize is a hint, with a minimum of 200.
Thanks for the info.

I swore I tore through the API doc and didn't see a mention of a minimum batch size.
Just to pick at it, SF might want to take out the examples that refer to setting the batch size to 3 then :smileywink:

Thanks AGAIN!
Turns out I had an older version of the 7.0 API doc.

Is there a mailing list or something that lets you know when the API docs are updated?

http://www.sforce.com/us/docs/sforce70/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sforceAPI_WWHelp&file=sforce_API_QueryOptions.html#wp1294649 Where's the sample that sets it to 3? (I'll get it fixed) the ones i found in the docs set it to 250.