Skip to content

Commit b0a0621

Browse files
committed
remove comments and original article
1 parent a8d1ac1 commit b0a0621

File tree

3 files changed

+13
-207
lines changed

3 files changed

+13
-207
lines changed

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

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,23 @@ Don't include columns you don't need in your query. Queries that return all colu
99

1010
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.
1111

12-
<!--
13-
14-
David: Most lookups are not logical attributes. Lookups include several supporting attributes that are logical, but the API doesn't return data for many of these. I'm talking about the fields that end with *Name.
15-
16-
Common Lookups that are also logical are OwningTeam or OwningUser, because they are special.
17-
18-
That's why I re-wrote the content below.
19-
20-
Queries with many logical attributes (for example, lookups) can also cause queries to be slow because each logical attribute needs to be retrieved from a seperate entity which can make a simple query much more complex and slow.
21-
22-
We recommend customers to design their queries to select the bare minimum of columns needed.
23-
24-
-->
2512

2613
### Avoid leading wild cards in filter conditions
2714

28-
Queries that use conditions with leading wild cards (either explicitly, or implicitly with an operator like `ends-with`) can lead to bad performance. Dataverse can't take advantage of database indexes when a query using leading wild cards, which forces SQL to scan the entire table. Table scans can happen even if there are other nonleading wild card queries that limit the result set.
15+
Queries that use conditions with leading wild cards (either explicitly, or implicitly with an operator like `ends-with`) can lead to bad performance. Dataverse can't take advantage of database indexes when a query using leading wild cards, which forces SQL to scan the entire table. Table scans can happen even if there are other non-leading wild card queries that limit the result set.
2916

30-
The following example is a FetchXml query that uses a leading wild card:
17+
The following example is a FetchXml [condition element](../fetchxml/reference/condition.md) that uses a leading wild card:
3118

3219
```xml
33-
<fetch>
34-
<entity name='account'>
35-
<attribute name='accountid' />
36-
<attribute name='accountnumber' />
37-
<filter type='and'>
38-
<condition attribute='accountnumber'
39-
operator='like'
40-
value='%234' />
41-
</filter>
42-
</entity>
43-
</fetch>
20+
<condition attribute='accountnumber'
21+
operator='like'
22+
value='%234' />
23+
```
24+
25+
The following example is a [QueryExpression](xref:Microsoft.Xrm.Sdk.Query.QueryExpression) [ConditionExpression](xref:Microsoft.Xrm.Sdk.Query.ConditionExpression) that uses a leading wild card:
26+
27+
```csharp
28+
new ConditionExpression("accountnumber", ConditionOperator.Like, "%234")
4429
```
4530

4631
When queries time out and this pattern is detected, Dataverse returns a unique error to help identify which queries are using this pattern:
@@ -78,29 +63,6 @@ To help prevent outages, Dataverse applies throttles on queries that have filter
7863

7964
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.
8065

81-
<!--
82-
83-
jdaly: I don't think this example adds much here.
84-
85-
Do you want to mention the fetch element useraworderby attribute?
86-
That might make for a good example
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-
92-
Example query ordering on the statecode choice column:
93-
94-
``` xml
95-
<fetch distinct='true'>
96-
<entity name='account'>
97-
<attribute name='accountnumber' />
98-
<order attribute='statecode' />
99-
</entity>
100-
</fetch>
101-
```
102-
-->
103-
10466
### Avoid ordering by columns in related tables
10567

10668
Ordering by columns on related tables makes the query slower because of the added complexity.
@@ -110,7 +72,6 @@ Ordering by related tables should only be done when needed to as described here:
11072
- [Order rows using FetchXml](../fetchxml/order-rows.md)
11173
- [Order rows using QueryExpression](../org-service/queryexpression/order-rows.md)
11274

113-
11475
### Avoid using conditions on large text columns
11576

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

powerapps-docs/developer/data-platform/optimize-queries-for-read-performance.md

Lines changed: 0 additions & 156 deletions
This file was deleted.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ Don't use leading wild cards in expressions using `like`, `startswith`, `not sta
112112
|`endswith(name,'value%')`|
113113
|`not endswith(name,'value%')`|
114114

115+
---
115116

116117
### See also
117118

118-
[Query data using FetchXml](fetchxml/overview.md)
119+
[Filter rows using FetchXml](fetchxml/filter-rows.md)
119120
[Filter rows using QueryExpression](org-service/queryexpression/filter-rows.md)
120121
[Query data using the Web API](webapi/query-data-web-api.md)
121122

0 commit comments

Comments
 (0)