Skip to content

Commit 5aee295

Browse files
committed
update group by example
1 parent 3f00534 commit 5aee295

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

articles/cosmos-db/troubleshoot-query-performance.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ This article provides examples that you can re-create by using the [nutrition](h
3232
- 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.
3333
- Sometimes queries may have empty pages even when there are results on a future page. Reasons for this could be:
3434
- 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.
3737

3838
## Get query metrics
3939

@@ -208,7 +208,7 @@ Other parts of the query might still use the index even though the system functi
208208
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,
209209
the query engine can evaluate additional filters and resort to loading remaining documents to compute the aggregate, if needed.
210210

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.
212212

213213
Query with only `CONTAINS` filter - higher RU charge:
214214

@@ -226,7 +226,7 @@ Here are additional examples of aggregates queries that will not fully use the i
226226

227227
#### Queries with system functions that don't use the index
228228

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.
230230

231231
```sql
232232
SELECT MAX(c._ts) FROM c WHERE CONTAINS(c.description, "spinach")
@@ -235,12 +235,12 @@ SELECT MAX(c._ts) FROM c WHERE CONTAINS(c.description, "spinach")
235235
#### Aggregate queries with user-defined functions(UDF's)
236236

237237
```sql
238-
SELECT AVG(c._ts) FROM c WHERE MyUDF("Sausages and Luncheon Meats")
238+
SELECT AVG(c._ts) FROM c WHERE udf.MyUDF("Sausages and Luncheon Meats")
239239
```
240240

241241
#### Queries with GROUP BY
242242

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.
244244

245245
```sql
246246
SELECT COUNT(1) FROM c WHERE c.foodGroup = "Sausages and Luncheon Meats" GROUP BY c.description

0 commit comments

Comments
 (0)