locked
Should I include attributes in a FetchXML query to improve speed? RRS feed

  • Question

  • I am querying using FetchXML using javascript but wondering if I want to improve the speed and execution time should I state which attributes to return? For instance, in most cases I do the following:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="new_account">
        <order attribute="new_name" descending="false" />
        <filter type="and">
          <condition attribute="new_opportunity" operator="eq" uiname="New Opportunity" uitype="opportunity" value="{3CBC481F-C563-E311-AA3E-D89D676400F8}" />
        </filter>
      </entity>
    </fetch>

    But, I have been advised to do it like this:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="new_account">
        <attribute name="new_accountid" />
        <attribute name="new_name" />
        <attribute name="createdon" />
        <order attribute="new_name" descending="false" />
        <filter type="and">
          <condition attribute="new_opportunity" operator="eq" uiname="New Opportunity" uitype="opportunity" value="{3CBC481F-C563-E311-AA3E-D89D676400F8}" />
        </filter>
      </entity>
    </fetch>

    I am told that this causes only certain fields to be returned and not the entire recordset.

    If anyone can advice I would be grateful.

    Friday, December 13, 2013 6:06 PM

All replies