Skip to content

Commit a17f969

Browse files
committed
added toc and fixed acrolinx issues
1 parent e30c295 commit a17f969

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

articles/cosmos-db/index-overview.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The goal of this article is to explain how Azure Cosmos DB indexes data and how
2020

2121
## From items to trees
2222

23-
Every time an item is stored in a container, its content is projected as a JSON document, then converted into a tree representation. What that means is that every property of that item gets represented as a node in a tree. A pseudo root node is created as a parent to all the first-level properties of the item. The leaf nodes contain the actual scalar values carried by an item.
23+
Every time an item is stored in a container, its content is projected as a JSON document, then converted into a tree representation. This means that every property of that item gets represented as a node in a tree. A pseudo root node is created as a parent to all the first-level properties of the item. The leaf nodes contain the actual scalar values carried by an item.
2424

2525
As an example, consider this item:
2626

@@ -201,7 +201,7 @@ Here is a table that summarizes the different ways indexes are used in Azure Cos
201201
| Full index scan | Read distinct set of indexed values and load only matching items from the transactional data store | Contains, EndsWith, RegexMatch, LIKE | Increases linearly based on the cardinality of indexed properties | Increases based on number of items in query results |
202202
| Full scan | Load all items from the transactional data store | Upper, Lower | N/A | Increases based on number of items in container |
203203
204-
When writing queries, you should use filter predicate that use the index as efficiently as possible. For example, if either `StartsWith` or `Contains` would work for your use case, you should opt for `StartsWith` since it will do a precise index scan instead of a full index scan.
204+
When writing queries, you should use filter predicate that uses the index as efficiently as possible. For example, if either `StartsWith` or `Contains` would work for your use case, you should opt for `StartsWith` since it will do a precise index scan instead of a full index scan.
205205
206206
## Index usage details
207207
@@ -273,7 +273,7 @@ The query predicate (filtering on items where any location has "France" as its c
273273

274274
:::image type="content" source="./media/index-overview/matching-path.png" alt-text="Matching a specific path within a tree" border="false":::
275275

276-
Since this query has an equality filter, after traversing this tree, we can quickly identify the index pages that contain the query results. In this case, the query engine would read index pages that contain Item 1. An index seek is the most efficient way to use the index. With an index seek we only read the necessary index pages and load only the items in the query results. Therefore, the index lookup time and RU charge from index lookup are incredibly low, regardless of the total data volume.
276+
Since this query has an equality filter, after traversing this tree, we can quickly identify the index pages that contain the query results. In this case, the query engine would read index pages that contain Item 1. An index seek is the most efficient way to use the index. With an index seek, we only read the necessary index pages and load only the items in the query results. Therefore, the index lookup time and RU charge from index lookup are incredibly low, regardless of the total data volume.
277277

278278
### Precise index scan
279279

@@ -345,15 +345,15 @@ FROM company
345345
WHERE company.headquarters.employees = 200 AND CONTAINS(company.headquarters.country, "United")
346346
```
347347

348-
To execute this query, the query engine must do an index seek on `headquarters/employees` and full index scan on `headquarters/country`. The query engine has internal heuristics that it uses to evaluate the query filter expression as efficiently as possible. In this case, the query engine would avoid needing to read unnecessary index pages by doing the index seek first. If, for example, only 50 items matched the equality filter, the query engine would only need to evaluate `Contains` on the index pages that contained those 50 items. A full index scan of the entire container wouldn't be necessary.
348+
To execute this query, the query engine must do an index seek on `headquarters/employees` and full index scan on `headquarters/country`. The query engine has internal heuristics that it uses to evaluate the query filter expression as efficiently as possible. In this case, the query engine would avoid needing to read unnecessary index pages by doing the index seek first. If for example, only 50 items matched the equality filter, the query engine would only need to evaluate `Contains` on the index pages that contained those 50 items. A full index scan of the entire container wouldn't be necessary.
349349

350350
## Index utilization for scalar aggregate functions
351351

352352
Queries with aggregate functions must rely exclusively on the index in order to use it.
353353

354354
In some cases, the index can return false positives. For example, when evaluating `Contains` on the index, the number of matches in the index may exceed the number of query results. The query engine will load all index matches, evaluate the filter on the loaded items, and return only the correct results.
355355

356-
For the majority of queries, loading false positive index matches will not have any noticeable impact on index utilization.
356+
For most queries, loading false positive index matches will not have any noticeable impact on index utilization.
357357

358358
For example, consider the following query:
359359

articles/cosmos-db/nosql/how-to-manage-indexing-policy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Here are some examples of indexing policies shown in [their JSON format](../inde
100100

101101
## <a id="composite-index"></a>Composite indexing policy examples
102102

103-
In addition to including or excluding paths for individual properties, you can also specify a composite index. If you would like to perform a query that has an `ORDER BY` clause for multiple properties, a [composite index](../index-policy.md#composite-indexes) on those properties is required. Additionally, composite indexes will have a performance benefit for queries that have a multiple filters or both a filter and an ORDER BY clause.
103+
In addition to including or excluding paths for individual properties, you can also specify a composite index. If you would like to perform a query that has an `ORDER BY` clause for multiple properties, a [composite index](../index-policy.md#composite-indexes) on those properties is required. Additionally, composite indexes will have a performance benefit for queries that have multiple filters or both a filter and an ORDER BY clause.
104104

105105
> [!NOTE]
106106
> Composite paths have an implicit `/?` since only the scalar value at that path is indexed. The `/*` wildcard is not supported in composite paths. You shouldn't specify `/?` or `/*` in a composite path.
@@ -336,7 +336,7 @@ ContainerResponse containerResponse = await client.GetContainer("database", "con
336336
long indexTransformationProgress = long.Parse(containerResponse.Headers["x-ms-documentdb-collection-index-transformation-progress"]);
337337
```
338338

339-
When defining a custom indexing policy while creating a new container, the SDK V3's fluent API lets you write this definition in a concise and efficient way:
339+
The SDK V3's fluent API lets you write this definition in a concise and efficient way when defining a custom indexing policy while creating a new container:
340340

341341
```csharp
342342
await client.GetDatabase("database").DefineContainer(name: "container", partitionKeyPath: "/myPartitionKey")

articles/cosmos-db/nosql/query/TOC.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@
226226
- name: Spatial functions
227227
displayName: spatial functions, spatial, system functions, built-in functions
228228
href: spatial-functions.md
229+
- name: ST_AREA
230+
displayName: ST_AREA, st area, area, built-in functions
231+
href: st-area.md
229232
- name: ST_DISTANCE
230233
displayName: ST_DISTANCE, st distance, distance, built-in functions
231234
href: st-distance.md

0 commit comments

Comments
 (0)