Skip to content

Commit a8d1ac1

Browse files
committed
check edits
1 parent 3e2760b commit a8d1ac1

File tree

3 files changed

+47
-79
lines changed

3 files changed

+47
-79
lines changed

powerapps-docs/developer/data-platform/includes/cc-query-antipatterns.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Patterns to avoid
22

3-
Composing optimized queries for Dataverse is vital to ensure applications provide a fast, responsive, and reliable experience. This sections describes patterns to avoid and concepts to understand when composing queries for standard tables using the `RetrieveMultiple` message, or messages that have a parameter that inherits from the [QueryBase class](/dotnet/api/microsoft.xrm.sdk.query.querybase). The guidance here might not apply for [Elastic tables](../elastic-tables.md) or when using [Dataverse Search](../search/overview.md).
3+
Composing optimized queries for Dataverse is vital to ensure applications provide a fast, responsive, and reliable experience. This section describes patterns to avoid and concepts to understand when composing queries for standard tables using the `RetrieveMultiple` message, or messages that have a parameter that inherits from the [QueryBase class](/dotnet/api/microsoft.xrm.sdk.query.querybase). The guidance here might not apply for [Elastic tables](../elastic-tables.md) or when using [Dataverse Search](../search/overview.md).
44

55

66
### Minimize the number of selected columns
@@ -76,7 +76,7 @@ To help prevent outages, Dataverse applies throttles on queries that have filter
7676

7777
### Avoid ordering by choice columns
7878

79-
When you request query results be ordered on a choice column, the results are ordered by the localized label of the choice values. Ordering by the number value stored in the database wouldn't provide a good experience in your application. You should know that ordering on choice columns requires more compute resources to join and sort the rows by the localized label value. This extra work makes the query slower. If possible, try to avoid ordering results by choice column values.
79+
When you order query results using a choice column, the results are sorted using the localized label for each choice option. Ordering by the number value stored in the database wouldn't provide a good experience in your application. You should know that ordering on choice columns requires more compute resources to join and sort the rows by the localized label value. This extra work makes the query slower. If possible, try to avoid ordering results by choice column values.
8080

8181
<!--
8282
@@ -115,12 +115,12 @@ Ordering by related tables should only be done when needed to as described here:
115115

116116
Dataverse has two types of columns that can store large strings of text:
117117

118-
- [StringAttributeMetadata](/dotnet/api/microsoft.xrm.sdk.metadata.stringattributemetadata) can store up to 4000 characters.
119-
- [MemoAttributeMetadata](/dotnet/api/microsoft.xrm.sdk.metadata.memoattributemetadata) can store a much higher number.
118+
- [StringAttributeMetadata](/dotnet/api/microsoft.xrm.sdk.metadata.stringattributemetadata) can store up to 4,000 characters.
119+
- [MemoAttributeMetadata](/dotnet/api/microsoft.xrm.sdk.metadata.memoattributemetadata) can store a higher number.
120120

121121
The limit for both of these columns is specified using the `MaxLength` property.
122122

123-
You can use conditions on string columns that have a `MaxLength` configured for less than 850 characters.
123+
You can use conditions on string columns that have a `MaxLength` configured for fewer than 850 characters.
124124

125125
All memo columns or string columns with a `MaxLength` greater than 850 are defined in Dataverse as large text columns. Large text columns are too large to effectively index, which leads to bad performance when included in a filter condition.
126126

Lines changed: 26 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,58 @@
11
---
2-
title: "Query throttling (Microsoft Dataverse)| Microsoft Docs"
2+
title: "Query throttling (Microsoft Dataverse)"
33
description: "Read about how the server can throttle a query to reduce system performance impact and what you can do about it."
4-
ms.custom: ""
5-
ms.date: 04/29/2021
6-
7-
ms.suite: ""
8-
ms.tgt_pltfrm: ""
9-
ms.topic: "article"
4+
ms.date: 06/04/2024
5+
ms.topic: article
106
applies_to:
117
- "Dynamics 365 (online)"
12-
ms.assetid: fc3ade34-9c4e-4c33-88a4-aa3842c5eee1
13-
caps.latest.revision: 78
14-
author: "pnghub"
8+
author: pnghub
159
ms.subservice: dataverse-developer
16-
ms.author: "gned"
17-
ms.reviewer: "pehecke"
10+
ms.author: gned
11+
ms.reviewer: pehecke
1812
search.audienceType:
1913
- developer
2014
---
2115

2216
# Query throttling
2317

24-
If a specific query creates a disproportional load on the database storing
25-
Microsoft Dataverse data, it can starve the database of resources and negatively impact
26-
performance of all data operations. When this happens Dataverse can start
27-
throttling that particular query which would allow all other scenarios to
28-
perform normally.
18+
If a specific query creates a disproportional load on the database storing Microsoft Dataverse data, it can starve the database of resources and negatively impact performance of all data operations. When this happens, Dataverse starts throttling that particular query to allow all other scenarios to perform normally.
2919

30-
The primary way in which *query throttling* is different from
31-
[Service protection API limits](api-limits.md) is
32-
query throttling targets a specific query that causes a performance degradation while
33-
leaving the rest of the traffic unaffected. If the throttled query
34-
originates from a non-interactive application, throttling is likely to not be
35-
noticeable for end-users. If the query originates from an interactive
36-
application it will affect users that exercise that particular scenario.
20+
The primary way in which *query throttling* is different from [Service protection API limits](api-limits.md) is
21+
query throttling targets a specific query that causes a performance degradation while leaving the rest of the traffic unaffected. If the throttled query originates from a non-interactive application, throttling is likely to not be noticeable for end-users. If the query originates from an interactive application, it affects users that exercise that particular scenario.
3722

3823
## Query throttling behavior
3924

4025
Throttling can manifest in three ways:
4126

42-
- A delay is introduced before each execution of the query, making the
43-
scenario that uses it slower
44-
27+
- A delay is introduced before each execution of the query, making the scenario that uses it slower
4528
- Some fraction of attempts to execute the query are failing with any of the following errors:
4629

47-
| **Error code** | **Hex code** | **Message** |
48-
|----------------|--------------|-----------------------------------------------------------------------------------------------------------------------------------|
49-
| \-2147187388 | 0x80048544 | This query cannot be executed because it conflicts with query throttling. Please refer to [Query throttling](query-throttling.md) |
50-
| \-2147187132 | 0x80048644 | This query cannot be executed because it conflicts with Query Throttling; the query uses a leading wildcard value in a filter condition, which will cause the query to be throttled more aggressively. Please refer to this document: https://go.microsoft.com/fwlink/?linkid=2162952 |
51-
| \-2147186876 | 0x80048744 | This query cannot be executed because it conflicts with Query Throttling; the query uses a computed column in a filter condition, which will cause the query to be throttled more aggressively. Please refer to this document: https://go.microsoft.com/fwlink/?linkid=2162952 |
30+
|Error code|Hex code|Message|
31+
|---|---|---|
32+
|`-2147187388`|`0x80048544`| `This query cannot be executed because it conflicts with query throttling.`|
33+
|`-2147187132`|`0x80048644`| `This query cannot be executed because it conflicts with Query Throttling; the query uses a leading wildcard value in a filter condition, which will cause the query to be throttled more aggressively.`|
34+
|`-2147186876`|`0x80048744`| `This query cannot be executed because it conflicts with Query Throttling; the query uses a computed column in a filter condition, which will cause the query to be throttled more aggressively.` |
5235

53-
For more infromation about more agressively throttled query patterns like leading wild cards can be found in [Optimize performance using FetchXml](fetchxml/optimize-performance.md)
36+
For more information about more aggressively throttled query patterns like leading wild cards can be found in [Optimize performance using FetchXml](fetchxml/optimize-performance.md) and [Optimize performance using QueryExpression](org-service/queryexpression/optimize-performance.md)
5437

5538
## Common causes
5639

57-
Most of the situations when query throttling is necessary fall into one of the
58-
two broad categories:
40+
Most of the situations when query throttling is necessary fall into one of these two broad categories:
5941

60-
- Some query in a common interactive scenario, for example a saved query used
61-
in a grid or a query executed by a plug-in, is inefficient and requires a lot
62-
of database resources for each execution
42+
- Some query in a common interactive scenario, for example a saved query used in a grid or a query executed by a plug-in, is inefficient and requires a lot of database resources for each execution
6343

64-
- An automated operation, for example data integration involving moving a
65-
large amount of data into or out of Dataverse, executes a query at a very
66-
high rate which consumes a lot of database resources in aggregate even if
67-
each execution is cheap
44+
- An automated operation, for example data integration involving moving a large amount of data into or out of Dataverse, executes a query at a high rate that consumes a lot of database resources in aggregate even if each execution is less expensive
6845

6946
## How to avoid query throttling
7047

71-
Query throttling depends on the query and the scenario where it is executed but there are some common guidelines:
72-
73-
- For slow low-frequency queries, typically used in interactive
74-
applications, the query structure needs to be changed to make it more
75-
efficient
76-
77-
- Some common guidelines for improving the query performance can be found
78-
in [Optimize performance using FetchXml](fetchxml/optimize-performance.md)
79-
80-
- For non-interactive applications the common ways to reduce the database load
81-
are:
48+
Query throttling depends on the query and the scenario where it's executed but there are some common guidelines:
8249

83-
- If [ExecuteMultiple](xref:Microsoft.Xrm.Sdk.Messages.ExecuteMultipleRequest) (or another batching mechanism) is used, the batch
84-
size can be reduced
50+
- For slow low-frequency queries, typically used in interactive applications, the query structure needs to be changed to make it more efficient
8551

86-
- If the application uses concurrency, the number of threads can be reduced
52+
- Some common guidelines for improving the query performance can be found in [Optimize performance using FetchXml](fetchxml/optimize-performance.md)
8753

88-
- A delay between requests can be introduced to reduce the request rate
89-
when neither batching nor concurrency are used
54+
- For non-interactive applications the common ways to reduce the database load are:
9055

56+
- When using [ExecuteMultiple](xref:Microsoft.Xrm.Sdk.Messages.ExecuteMultipleRequest) (or another batching mechanism), reduce the size of the batch
57+
- If the application is multi-threaded, reduce the number of concurrent threads
58+
- If you aren't using batching or concurrent requests, add a delay between requests to reduce the request rate

powerapps-docs/developer/data-platform/wildcard-characters.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Use wildcard characters in conditions for string values
33
description: Learn how to use wildcard characters in query conditions that use string values.
4-
ms.date: 04/17/2023
4+
ms.date: 06/04/2024
55
ms.reviewer: jdaly
66
ms.topic: conceptual
77
author: mayadumesh
@@ -14,10 +14,10 @@ contributors:
1414
ms.custom: bap-template
1515
---
1616
# Use wildcard characters in conditions for string values
17-
<!-- dasuss TODO: Improve this Docs to be clearer -->
17+
1818
You can use wildcard characters with the following operators when you build queries that include conditions on string values:
1919

20-
# [FetchXml](#tab/fetchxml)
20+
## [FetchXml](#tab/fetchxml)
2121

2222
`like`<br/>
2323
`not-like`<br/>
@@ -29,7 +29,7 @@ You can use wildcard characters with the following operators when you build quer
2929
More information: [Query data using FetchXml](fetchxml/overview.md)
3030

3131

32-
# [QueryExpression](#tab/queryexpression)
32+
## [QueryExpression](#tab/queryexpression)
3333

3434
<xref:Microsoft.Xrm.Sdk.Query.ConditionOperator>.`Like`<br/>
3535
<xref:Microsoft.Xrm.Sdk.Query.ConditionOperator>.`NotLike`<br/>
@@ -40,7 +40,7 @@ More information: [Query data using FetchXml](fetchxml/overview.md)
4040

4141
More information: [Filter rows using QueryExpression](org-service/queryexpression/filter-rows.md)
4242

43-
# [Web API](#tab/webapi)
43+
## [Web API](#tab/webapi)
4444

4545
`contains`<br/>
4646
`not contains`<br/>
@@ -67,15 +67,17 @@ When you use these condition operators, you can use certain characters to repres
6767

6868
You can use the wildcard pattern matching characters as literal characters. To use a wildcard character as a literal character, enclose the wildcard character in brackets. More information: [Using Wildcard Characters As Literals](/sql/t-sql/language-elements/like-transact-sql#using-wildcard-characters-as-literals).
6969

70-
## Don't use leading wild cards.
70+
## Don't use leading wild cards
71+
72+
Queries which use condition operators with implicit leading wild cards (like `ends-with`) or explicit leading wild cards will be less performant and can lead to poor performance across the organization in certain scenarios. More information:
73+
- [Optimize performance using FetchXml](fetchxml/optimize-performance.md)
74+
- [Optimize performance using QueryExpression](org-service/queryexpression/optimize-performance.md)
7175

72-
Queries which use condition operators with implicit leading wild cards (ex. ends-with) or explicit leading wild cards will be less performant and can lead to poor performance across the organization in certain scenarios. More information in [Optimize performance using FetchXml](fetchxml/optimize-performance.md).
7376
Queries that use these anti-patterns introduce performance problems because the queries can't be optimized.
7477

75-
# [FetchXml](#tab/fetchxml)
78+
### [FetchXml](#tab/fetchxml)
7679

77-
Don't use trailing wild cards in expressions using `like`, `begins-with`, `not-begin-with`, `ends-with`, or `not-end-with`.
78-
Here are some examples of trailing wildcards:
80+
Don't use trailing wild cards in expressions using `like`, `begins-with`, `not-begin-with`, `ends-with`, or `not-end-with`. Here are some examples of trailing wildcards:
7981

8082
|Bad Examples |
8183
|---------|
@@ -85,10 +87,9 @@ Here are some examples of trailing wildcards:
8587
|`<condition attribute='name' operator='ends-with' value='value' />`|
8688
|`<condition attribute='name' operator='not-ends-with' value='value' />`|
8789

88-
# [QueryExpression](#tab/queryexpression)
90+
### [QueryExpression](#tab/queryexpression)
8991

90-
Don't use leading wild cards in expressions using `like`, `BeginsWith`, `DoesNotBeginWith`, `EndsWith`, or `DoesNotEndWith`.
91-
Here are some examples of excess wildcards:
92+
Don't use leading wild cards in expressions using `Like`, `BeginsWith`, `DoesNotBeginWith`, `EndsWith`, or `DoesNotEndWith`. Here are some examples of excess wildcards:
9293

9394
|Bad Examples |
9495
|---------|
@@ -98,10 +99,9 @@ Here are some examples of excess wildcards:
9899
|`query.Criteria.AddCondition("name", ConditionOperator.EndsWith, "value");`|
99100
|`query.Criteria.AddCondition("name", ConditionOperator.DoesNotEndWith, "value");`|
100101

101-
# [Web API](#tab/webapi)
102+
### [Web API](#tab/webapi)
102103

103-
Don't use leading wild cards in expressions using `like`, `startswith`, `not startswith`, `endswith`, or `not endswith`.
104-
Here are some examples of excess wildcards:
104+
Don't use leading wild cards in expressions using `like`, `startswith`, `not startswith`, `endswith`, or `not endswith`. Here are some examples of excess wildcards:
105105

106106

107107
|Bad Examples |

0 commit comments

Comments
 (0)