You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/includes/cc-query-antipatterns.md
+12-22Lines changed: 12 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Composing optimized queries for Dataverse is vital to ensure applications provid
5
5
6
6
### Minimize the number of selected columns
7
7
8
-
Don't include columns you don't need in your query. Queries that return all columns or include a large number of columns can encounter performance issues due to the size of the dataset.
8
+
Don't include columns you don't need in your query. Queries that return all columns or include a large number of columns can encounter performance issues due to the size of the dataset or complexity of the query.
9
9
10
10
This practice is especially true for *logical columns*. A logical column contains values that are stored in different database tables. The [AttributeMetadata.IsLogical property](/dotnet/api/microsoft.xrm.sdk.metadata.attributemetadata.islogical) tells you whether a column is a logical column. Queries that contain many logical columns are slower because Dataverse needs to combine the data from other database tables.
11
11
@@ -43,25 +43,12 @@ The following example is a FetchXml query that uses a leading wild card:
43
43
</fetch>
44
44
```
45
45
46
-
47
46
When queries using leading wild cards timeout, the following error is returned:
48
47
49
-
<!--
50
-
51
-
Can this link to the current failure text in https://learn.microsoft.com/en-us/power-apps/developer/data-platform/reference/web-service-error-codes
52
-
53
-
jdaly: No. You can't link to an item within a table.
54
-
-->
55
-
<!--
56
-
57
-
Also we should update the throttle page to link back to here for the different rules
> Message: `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`
48
+
> Name: `LeadingWildcardCauseTimeout`<br />
49
+
> Code: `0x80048573`<br />
50
+
> Number: `-2147187341`<br />
51
+
> Message: `The database operation timed out; this may be due to a leading wildcard value being used in a filter condition. Please consider removing filter conditions on leading wildcard values, as these filter conditions are expensive and may cause timeouts.`
65
52
66
53
Dataverse heavily throttles leading wild card queries that are identified as a risk to the health of the org to help prevent outages. [Learn more about query throttling](../query-throttling.md)
67
54
@@ -72,6 +59,7 @@ If you find yourself using leading wild card queries, look into these options:
72
59
73
60
[Learn more about using wildcard characters in conditions for string values](../wildcard-characters.md)
74
61
62
+
75
63
### Avoid using formula or calculated columns in filter conditions
76
64
77
65
[Formula and calculated column](../calculated-rollup-attributes.md#formula-and-calculated-columns) values are calculated in real-time when they're retrieved. Queries that use filters on these columns force Dataverse to calculate the value for each possible record that can be returned so the filter can be applied. Queries are slower because Dataverse can't improve the performance of these queries using SQL.
@@ -90,14 +78,17 @@ To help prevent outages, Dataverse applies throttles on queries that have filter
90
78
91
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.
92
80
93
-
94
81
<!--
95
82
96
83
jdaly: I don't think this example adds much here.
97
84
98
85
Do you want to mention the fetch element useraworderby attribute?
99
86
That might make for a good example
100
87
88
+
dasuss: I'm conflicted when it comes to useraworderby, yeah its supported and technically works,
89
+
but I don't think its worth doing in place of ordering on the name. We would be adding an order that doesn't
90
+
make logical sense for the customer (ie the state code Number doesn't mean anything of logical value).
91
+
101
92
Example query ordering on the statecode choice column:
102
93
103
94
``` xml
@@ -120,8 +111,7 @@ Ordering by related tables should only be done when needed to as described here:
120
111
-[Order rows using QueryExpression](../org-service/queryexpression/order-rows.md)
121
112
122
113
123
-
### Avoid using like conditions on large text columns
124
-
114
+
### Avoid using conditions on large text columns
125
115
126
116
Dataverse has two types of columns that can store large strings of text:
127
117
@@ -130,7 +120,7 @@ Dataverse has two types of columns that can store large strings of text:
130
120
131
121
The limit for both of these columns is specified using the `MaxLength` property.
132
122
133
-
You can use `like`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 less than 850 characters.
134
124
135
125
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.
|\-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|
52
+
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)
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/wildcard-characters.md
+15-14Lines changed: 15 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -67,50 +67,51 @@ When you use these condition operators, you can use certain characters to repres
67
67
68
68
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).
69
69
70
-
## Don't use trailing wild cards
70
+
## Don't use leading wild cards.
71
71
72
-
Using trailing wildcards isn't supported.
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).
73
+
Queries that use these anti-patterns introduce performance problems because the queries can't be optimized.
73
74
74
75
# [FetchXml](#tab/fetchxml)
75
76
76
-
Don't use trailing wild cards in expressions using `begins-with`, `not-begin-with`, `ends-with`, or `not-end-with`.
77
+
Don't use trailing wild cards in expressions using `like`, `begins-with`, `not-begin-with`, `ends-with`, or `not-end-with`.
0 commit comments