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: articles/cosmos-db/troubleshoot-query-performance.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,8 +32,8 @@ This article provides examples that you can re-create by using the [nutrition](h
32
32
- The number of items in a page will always be less than the specified `MaxItemCount`. However, `MaxItemCount` is strictly a maximum and there could be fewer results than this amount.
33
33
- Sometimes queries may have empty pages even when there are results on a future page. Reasons for this could be:
34
34
- The SDK could be doing multiple network calls.
35
-
- The query might be taking a long to retrieve the documents.
36
-
- All queries a continuation token that will allow the query to continue. Be sure to drain the query completely. Look at the SDK samples, and use a `while` loop on `FeedIterator.HasMoreResults` to drain the entire query.
35
+
- The query might be taking a long time to retrieve the documents.
36
+
- All queries have a continuation token that will allow the query to continue. Be sure to drain the query completely. Look at the SDK samples, and use a `while` loop on `FeedIterator.HasMoreResults` to drain the entire query.
37
37
38
38
## Get query metrics
39
39
@@ -208,7 +208,7 @@ Other parts of the query might still use the index even though the system functi
208
208
In most cases, aggregate system functions in Azure Cosmos DB will use the index. However, depending on the filters or additional clauses in an aggregate query, the query engine may be required to load a high number of documents. Typically, the query engine will apply equality and range filters first. After applying these filters,
209
209
the query engine can evaluate additional filters and resort to loading remaining documents to compute the aggregate, if needed.
210
210
211
-
For example, given these two sample queries, the query with both an equality and `CONTAINS` system function filter will generally be more efficient than a query with just the`CONTAINS` system function filter. This is because the equality filter is applied first and uses the index before documents need to be loaded for the more expensive `CONTAINS` filter.
211
+
For example, given these two sample queries, the query with both an equality and `CONTAINS` system function filter will generally be more efficient than a query with just a`CONTAINS` system function filter. This is because the equality filter is applied first and uses the index before documents need to be loaded for the more expensive `CONTAINS` filter.
212
212
213
213
Query with only `CONTAINS` filter - higher RU charge:
214
214
@@ -226,7 +226,7 @@ Here are additional examples of aggregates queries that will not fully use the i
226
226
227
227
#### Queries with system functions that don't use the index
228
228
229
-
You should refer to the specific[system function's page](sql-query-system-functions.md) to see if it uses the index.
229
+
You should refer to the relevant[system function's page](sql-query-system-functions.md) to see if it uses the index.
230
230
231
231
```sql
232
232
SELECTMAX(c._ts) FROM c WHERE CONTAINS(c.description, "spinach")
@@ -235,12 +235,12 @@ SELECT MAX(c._ts) FROM c WHERE CONTAINS(c.description, "spinach")
235
235
#### Aggregate queries with user-defined functions(UDF's)
236
236
237
237
```sql
238
-
SELECTAVG(c._ts) FROM c WHERE MyUDF("Sausages and Luncheon Meats")
238
+
SELECTAVG(c._ts) FROM c WHEREudf.MyUDF("Sausages and Luncheon Meats")
239
239
```
240
240
241
241
#### Queries with GROUP BY
242
242
243
-
The RU charge of `GROUP BY` will increase as the cardinality of the properties in the `GROUP BY` clause increases.
243
+
The RU charge of `GROUP BY` will increase as the cardinality of the properties in the `GROUP BY` clause increases. In this example, the query engine must load every document that matches the `c.foodGroup = "Sausages and Luncheon Meats"` filter so the RU charge is expected to be high.
244
244
245
245
```sql
246
246
SELECTCOUNT(1) FROM c WHEREc.foodGroup="Sausages and Luncheon Meats"GROUP BYc.description
0 commit comments