|
| 1 | +--- |
| 2 | +title: "Work with Quick Find’s search item limit (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces |
| 3 | +description: " " # 115-145 characters including spaces. This abstract displays in the search result. |
| 4 | +ms.custom: "" |
| 5 | +ms.date: 08/18/2020 |
| 6 | +ms.reviewer: "pehecke" |
| 7 | +ms.service: powerapps |
| 8 | +ms.topic: "article" |
| 9 | +author: "NHelgren" # GitHub ID |
| 10 | +ms.author: "nhelgren" # MSFT alias of Microsoft employees only |
| 11 | +manager: "jday" # MSFT alias of manager or PM counterpart |
| 12 | +search.audienceType: |
| 13 | + - developer |
| 14 | +search.app: |
| 15 | + - PowerApps |
| 16 | + - D365CE |
| 17 | +--- |
| 18 | + |
| 19 | +# Work with Quick Find’s search item limit |
| 20 | + |
| 21 | +Quick Find provides an easy way to configure the default search experience |
| 22 | +across Dynamics 365 Customer Engagement or Common Data Service entities. Quick Find provides optimized searching across multiple fields in a single query. When using Quick Find, the data service may return an error during a |
| 23 | +query indicating: |
| 24 | + |
| 25 | +*The number of records for this search exceeds the Quick Search record limit.* |
| 26 | + |
| 27 | +This error occurs because the query received too many results and has been stopped to prevent the data service's resource consumption from causing potential outages. This article will explain how the 10,000 search item limit is calculated and includes best practices to avoid hitting this limit. |
| 28 | + |
| 29 | +> [!NOTE] |
| 30 | +> A Quick Find is a FetchXML query that contains one of these filter attributes: `isquickfindquery`, `isquickfindfields`. |
| 31 | +
|
| 32 | +## How the search item limit is calculated |
| 33 | + |
| 34 | +Quick Find queries use a two-stage execution. The first stage uses the Quick |
| 35 | +Find filters and the provided search string to gather the records before applying |
| 36 | +additional filters. The query engine enforces the 10,000 record limit during this stage. |
| 37 | + |
| 38 | +The second stage uses the result set from the first stage and runs any remaining |
| 39 | +filters, for example: related record or security filters. |
| 40 | + |
| 41 | +Consider the following FetchXML Quick Find query: |
| 42 | + |
| 43 | +```xml |
| 44 | +<fetch version='1.0' output-format='xml-platform' mapping='logical'> |
| 45 | + <entity name='account'> |
| 46 | + <attribute name='name' /> |
| 47 | + <filter type='or' isquickfindfields='1' overridequickfindrecordlimitenabled='1'> |
| 48 | + <condition attribute='name' operator='like' value='%A%' /> |
| 49 | + </filter> |
| 50 | + <filter type='and'> |
| 51 | + <condition attribute='statecode' operator='eq' value='0'/> |
| 52 | + </filter> |
| 53 | + </entity> |
| 54 | +</fetch> |
| 55 | +``` |
| 56 | + |
| 57 | +The query engine will execute the condition on “name” first. Since the search is |
| 58 | +using wild cards with a short search string, the query will hit the 10k limit |
| 59 | +before running any other filters. It is important to note that even if the |
| 60 | +result set after the second stage (when applying a state code value) would have |
| 61 | +filtered down to less than 10k records, the query engine will hit the exception |
| 62 | +in the first stage and not progress to stage two. |
| 63 | + |
| 64 | +## When the search limit does not apply to Quick Find queries |
| 65 | + |
| 66 | +The query engine treats Quick Find queries with 1 or zero search columns as a |
| 67 | +standard query and not a Quick Find. Such queries are not subject to the 10,000 record |
| 68 | +limit. The reason being Quick Find queries with 1 or less conditions perform |
| 69 | +better as a standard query than a Quick Find. |
| 70 | + |
| 71 | +## Avoiding the search limit exception |
| 72 | + |
| 73 | +When writing and executing Quick Find queries in Dynamics 365 Customer ENgagement or Common Data Service, use the following tips to avoid the 10k search limit: |
| 74 | + |
| 75 | +### Best practices when querying |
| 76 | + |
| 77 | +The following best practices should be observed when querying data. |
| 78 | + |
| 79 | +- Avoid adding unnecessary fields into the Quick Find query view |
| 80 | +- Keep queries as precise as possible avoiding generic queries and |
| 81 | + unnecessary wild cards |
| 82 | + |
| 83 | +### Specific exception querying |
| 84 | + |
| 85 | +If you have a specific need to have a query exceed this limit on a temporary basis, edit the FetchXML query to include setting the `overridequickfindrecordlimitenabled` attribute equal to 0 within the filter XML element. Use of this attribute will disable the 10k limit for the specific Quick Find query. |
| 86 | + |
| 87 | +### Organizational override |
| 88 | + |
| 89 | +In extreme cases where a business organization query regularly returns more than 10k search items, an administrator can contact Microsoft Support to request the 10k item limit be disabled. Disabling the limit is not recommended and can result in over consumption of resources and environment wide outages if misused. |
| 90 | + |
| 91 | +### See Also |
| 92 | + |
| 93 | +[Use FetchXML to construct a query](use-fetchxml-construct-query.md) |
0 commit comments