Resources
An Azure Cosmos DB account is a container for one or more databases. An Azure Cosmos DB database is a container for one or more collections. A collection contains documents. A document is an unstructured set of key/value pairs, read and written in JSON format.
Partitioning
Partitioning is the distribution and grouping of your data across the underlying resources. Documents are grouped in a partition based on the value of the partition key. You specify the partition key when you create the collection. To better understand the concept of partition keys, let's review the property and values in the following JSON example document.
{
"OrderTime": "4:21 PM",
"id": "e152c6b5-2d9b-f232-6f58-de17190ecfec",
"OrderStatus": "NEW",
"Item": {
"id": "52841410-7500-828d-e932-66f166e6f87f",
"Title": "8vlyf0jyvexfv3f",
"Category": "Books",
"UPC": "74:8585:249",
"Website": "https://pzr.khdftcp.com",
"ReleaseDate": "2019-01-10T16:21:41.039088-08:00",
"Condition": "NEW",
"Merchant": "24/7",
"ListPricePerItem": 13.41,
"PurchasePrice": 12.76,
"Currency": "USD"
},
"Quantity": 24,
"PaymentInstrumentType": 1,
"PurchaseOrderNumber": "422-40277-87",
"Customer": {
"id": "297b2be8-f31f-cd84-4013-5a9a13a8aae6",
"FirstName": "Clair",
"LastName": "Weber",
"Email": "Clair.Weber@yahoo.com",
"StreetAddress": "594 Stoltenberg Divide",
"ZipCode": "93267-7740",
"State": "VT"
},
"ShippingDate": "2019-01-16T16:21:41.65195-08:00",
"Data": "2FgYt+9u0FiL4Q=="
}
Any of these properties, or a combination of them, can be a partition key. For example, where you defined the partition key as a combination of the properties Category and Merchant, any documents that have matching values for Category and Merchant are grouped in the same partition.
An effective partitioning strategy distributes data and access evenly across partitions, and across time. Querying documents from within the same partition is less expensive than querying across partitions.
You choose how to partition your data at design time. The partitioning configuration can't be changed after a collection is provisioned.
Indexing
An index is a catalog of document properties and their values. It includes links to documents that contain properties equal to each property value. Indexing makes searching a collection more efficient. But the search efficiency is balanced with the resources required to insert or change a document. When a document is inserted or changed, Azure Cosmos DB has to update the index. The optimal indexing strategy for your collection depends on your workload.
Unlike partitioning, you can change indexing at runtime.
Source : https://docs.microsoft.com/en-us/azure/cosmos-db/
Source : https://docs.microsoft.com/en-us/azure/cosmos-db/
No comments:
Post a Comment