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
+16-15Lines changed: 16 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,52 +20,53 @@ You can reference the below section to understand the relevant query optimizatio
20
20
21
21
### Query's RU charge is too high
22
22
23
-
<br>
24
23
<br>
25
24
26
25
#### Loaded Document Count is significantly greater than Retrieved Document Count
27
26
28
-
a. [Ensure that the indexing policy includes necessary paths](troubleshoot-query-performance.md#Ensure-that-the-indexing-policy-includes-necessary-paths)
27
+
a. [Ensure that the indexing policy includes necessary paths](#ensure-that-the-indexing-policy-includes-necessary-paths)
29
28
30
-
b. [Understand which system functions utilize the index](troubleshoot-query-performance.md#Understand-which-system-functions-utilize-the-index)
29
+
b. [Understand which system functions utilize the index](#understand-which-system-functions-utilize-the-index)
31
30
32
-
c. [Optimize queries with both a filter and an ORDER BY clause](troubleshoot-query-performance.md#Optimize-queries-with-both-a-filter-and-an-ORDER-BY-clause)
31
+
c. [Optimize queries with both a filter and an ORDER BY clause](#optimize-queries-with-both-a-filter-and-an-order-by-clause)
33
32
34
-
d. [Optimize queries that use DISTINCT](#Optimize-queries-that-use-DISTINCT)
33
+
d. [Optimize queries that use DISTINCT](#optimize-queries-that-use-distinct)
35
34
36
-
e. [Optimize JOIN expressions by using a subquery](troubleshoot-query-performance.md#Optimize-JOIN-expressions-by-using-a-subquery)
35
+
e. [Optimize JOIN expressions by using a subquery](#optimize-join-expressions-by-using-a-subquery)
37
36
38
37
<br>
39
38
40
39
#### Loaded Document Count is approximately equal to Retrieved Document Count
41
40
42
-
a. [Avoid cross partition queries](troubleshoot-query-performance.md#Avoid-cross-partition-queries)
41
+
a. [Avoid cross partition queries](#Avoid-cross-partition-queries)
43
42
44
-
b. [Optimize queries that have a filter on multiple properties](troubleshoot-query-performance.md#Optimize-queries-that-have-a-filter-on-multiple-properties)
43
+
b. [Optimize queries that have a filter on multiple properties](#optimize-queries-that-have-a-filter-on-multiple-properties)
45
44
46
-
c. [Optimize queries with both a filter and an ORDER BY clause](troubleshoot-query-performance.md#Optimize-queries-with-both-a-filter-and-an-ORDER-BY-clause)
45
+
c. [Optimize queries with both a filter and an ORDER BY clause](#optimize-queries-with-both-a-filter-and-an-order-by-clause)
47
46
48
47
<br>
49
48
50
49
### Query's RU charge is acceptable but latency is still too high
51
50
52
-
a. [Improving proximity between your app and Azure Cosmos DB](troubleshoot-query-performance.md#Improving-proximity-between-your-app-and-Azure-Cosmos-DB)
51
+
a. [Improving proximity between your app and Azure Cosmos DB](#improving-proximity-between-your-app-and-azure-cosmos-db)
53
52
54
-
b. [Increasing provisioned throughput](troubleshoot-query-performance.md#Increasing-provisioned-throughput)
53
+
b. [Increasing provisioned throughput](#increasing-provisioned-throughput)
55
54
56
-
c. [Increasing MaxConcurrency](troubleshoot-query-performance.md#Increasing-MaxConcurrency)
55
+
c. [Increasing MaxConcurrency](#increasing-maxconcurrency)
57
56
58
-
d. [Increasing MaxBufferedItemCount](troubleshoot-query-performance.md#Increasing-MaxBufferedItemCount)
57
+
d. [Increasing MaxBufferedItemCount](#increasing-maxbuffereditemcount)
59
58
60
59
### Obtaining query metrics:
61
60
62
-
When optimizing a query in Azure Cosmos DB, the first step is always to [obtain the query metrics](https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-sql-query-metrics#query-execution-metrics) for your query These are also available through the Azure Portal as shown below:
61
+
When optimizing a query in Azure Cosmos DB, the first step is always to [obtain the query metrics](sql-api-sql-query-metrics.md#query-execution-metrics) for your query. These are also available through the Azure Portal as shown below:
After obtaining query metrics, compare the Retrieved Document Count with the Loaded Document Count for your query. Use this comparison to identify the relevant sections to reference below.
66
+
66
67
## Optimizations for queries where Loaded Document Count significantly exceeds Retrieved Document Count:
67
68
68
-
After obtaining query metrics, compare the Retrieved Document Count with the Loaded Document Count for your query. The Retrieved Document Count is the number of documents that will show up in the results of your query. The Loaded Document Count is the number of documents that needed to be scanned. If the Loaded Document Count is significantly higher than the Retrieved Document Count, then there was at least one part of your query that was unable to utilize the index.
69
+
The Retrieved Document Count is the number of documents that will show up in the results of your query. The Loaded Document Count is the number of documents that needed to be scanned. If the Loaded Document Count is significantly higher than the Retrieved Document Count, then there was at least one part of your query that was unable to utilize the index.
69
70
70
71
## Ensure that the indexing policy includes necessary paths
0 commit comments