Skip to content

Commit e06ac2a

Browse files
authored
Update how-to-create-indexes.md
1 parent 3c19344 commit e06ac2a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

articles/cosmos-db/mongodb/vcore/how-to-create-indexes.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,29 @@ ms.date: 6/24/2024
1616
[!INCLUDE[MongoDB vCore](~/reusable-content/ce-skilling/azure/includes/cosmos-db/includes/appliesto-mongodb-vcore.md)]
1717

1818
## Queryable fields should always have indexes created
19-
Read operations based on predicates and aggregates will first consult the index for the corresponding filters. In the absence of indexes, the database engine will perform a document scan to retrieve the matching documents. Scans will always be expensive and will get progressively more expensive as the volume of data in a collection continues to grow. For optimal queri performance, indexes should always be created for all queryable fields.
19+
Read operations based on predicates and aggregates consult the index for the corresponding filters. In the absence of indexes, the database engine performs a document scan to retrieve the matching documents. Scans are always expensive and get progressively more expensive as the volume of data in a collection grows. For optimal queri performance, indexes should always be created for all queryable fields.
2020

2121
## Avoid unnecessary indexes and indexing all fields by default
22-
While indexes should be created for all queryable fields, other fields within the document structure in a collection should not be indexed (either individually or through wildcard indexing) if they are not going to be part of query predicates or filters.
22+
While indexes should be created for all queryable fields, other fields within the document structure in a collection should not be indexed (either individually or through wildcard indexing) if they are not part of query predicates or filters.
2323

2424
> [!TIP]
25-
> Azure Cosmos DB for MongoDB vCore only indexes the _id field by default. All other fields are not indexed by default. The fields to be indexed should be planned ahead of time to maximize query performance while minimizing impact on write throughput from indexing too many fields.
25+
> Azure Cosmos DB for MongoDB vCore only indexes the _id field by default. All other fields are not indexed by default. The fields to be indexed should be planned ahead of time to maximize query performance, while minimizing impact on writes from indexing too many fields.
2626
27-
When a new document is inserted for the first time or an existing document is updated or deleted, each of the specified fields in the index also needs to be updated. If the indexing policy contains a large number of fields (or all the fields in the document), additional resources will be consumed by the server in updating the corresponding indexes. When running at scale, only the queryable fields should be indexed while all other fields not used in query predicates should be excluded from the index.
27+
When a new document is inserted for the first time or an existing document is updated or deleted, each of the specified fields in the index is also updated. If the indexing policy contains a large number of fields (or all the fields in the document), additional resources are consumed by the server in updating the corresponding indexes. When running at scale, only the queryable fields should be indexed while all remaining fields not used in query predicates should remain excluded from the index.
2828

2929
## Create the necessary indexes prior to data ingestion
30-
For optimal performance, indexes should be created upfront before data is loaded. This ensures all documents that are inserted for the first time or subsequently updated or deleted will have the corresponding indexes updated synchronously as part of the write operation. If indexes are created after data has been ingested, additional server resources will be consumed to index historical data. Depending on the size of the historical data, this can be time consuming and could impact steady state read and write performance.
30+
For optimal performance, indexes should be created upfront before data is loaded. This ensures all documents inserted for the first time or subsequently updated or deleted will have corresponding indexes updated synchronously. If indexes are created after data is ingested, additional server resources are consumed to index historical data. Depending on the size of the historical data, this operation is time consuming and impacts steady state read and write performance.
3131

3232
> [!NOTE]
33-
For scenarios where indexes need to be added at a later time due to changes in read patterns, background indexing needs to be enabled on the cluster which can be done through a support ticket.
33+
For scenarios where read patterns change and indexes need to be added, background indexing should be enabled, which can be done through a support ticket.
3434

3535
## For multiple indexes created on historical data, issue non-blocking createIndex commands for each field
3636
It is not always possible to plan for all query patterns upfront, particularly as application requirements evolve. Changing business and application needs will inevitably require fields to be added to the index on a cluster with a large amount of historical data.
3737

3838
In such scenarios, each createIndex command should be issued asynchronously without waiting on a response from the server.
3939

4040
> [!NOTE]
41-
By default, Azure Cosmos DB for MongoDB vCore responds to a createIndex operation only after the index has been fully built on the historical data. Depending on the size of the cluster and the volume of data already ingested, this can take time and may appear as though the server is not responding to the createIndex command.
41+
By default, Azure Cosmos DB for MongoDB vCore responds to a createIndex operation only after the index is fully built on historical data. Depending on the size of the cluster and the volume of data ingested, this can take time and appear as though the server is not responding to the createIndex command.
4242

4343
If the createIndex commands are being issued through the Mongo Shell, use Ctrl + C to interrupt the command to stop waiting on a response and issue the next set of operations.
4444

0 commit comments

Comments
 (0)