Skip to content

Commit a31a19e

Browse files
authored
Merge pull request #4090 from MicrosoftDocs/pehecke-partition-key
New feature documentation for partition key
2 parents f06c4ba + 9739a9f commit a31a19e

15 files changed

+223
-7
lines changed

powerapps-docs/developer/data-platform/data-synchronization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Data Synchronization (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3-
description: "Sometimes you’ll need to synchronize and integrate Microsoft Dataverse data with data that is stored in other systems. The common data integration patterns include taking data from an external system and pushing it into Dataverse, taking data from Dataverse and synchronizing it to some external data store, or updating Dataverse with external data. You can now use several new capabilities to make it easier to write code to achieve these scenarios." # 115-145 characters including spaces. This abstract displays in the search result.
3+
description: "Learn about synchronizing Dataverse data with external systems." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
55
ms.date: 03/24/2021
66
ms.reviewer: "pehecke"

powerapps-docs/developer/data-platform/deployment-service/administer-deployment-using-deployment-web-service.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Administer the deployment using the deployment web service (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3-
description: "<Description>" # 115-145 characters including spaces. This abstract displays in the search result.
3+
description: "Learn about the deployment web service." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
55
ms.date: 10/31/2018
66
ms.reviewer: "pehecke"

powerapps-docs/developer/data-platform/developer-resources-page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Developer resources page (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3-
description: "<Description>" # 115-145 characters including spaces. This abstract displays in the search result.
3+
description: "Learn about the developer resources web page." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
55
ms.date: 10/31/2018
66
ms.reviewer: "pehecke"

powerapps-docs/developer/data-platform/on-premises-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "On-premises deployment options (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3-
description: "<Description>" # 115-145 characters including spaces. This abstract displays in the search result.
3+
description: "Learn about deployment options for an on-premise installation." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
55
ms.date: 10/31/2018
66
ms.reviewer: "pehecke"

powerapps-docs/developer/data-platform/org-service/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
href: entity-operations-update-delete.md
5454
- name: Associate and disassociate entities
5555
href: entity-operations-associate-disassociate.md
56+
- name: Access entity data faster using partitions
57+
href: azure-storage-partitioning-sdk.md
5658
- name: Use messages
5759
href: use-messages.md
5860
- name: Special Operations
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: "Improve performance using storage partitions when accessing entity data (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3+
description: "Learn how to improve performance when accessing non-relational entity date." # 115-145 characters including spaces. This abstract displays in the search result.
4+
ms.custom: ""
5+
ms.date: 01/25/2021
6+
ms.reviewer: "pehecke"
7+
ms.service: powerapps
8+
ms.topic: "article"
9+
author: "JimDaly" # GitHub ID
10+
ms.author: "pehecke" # MSFT alias of Microsoft employees only
11+
manager: "sunilg" # MSFT alias of manager or PM counterpart
12+
search.audienceType:
13+
- developer
14+
search.app:
15+
- PowerApps
16+
- D365CE
17+
---
18+
# Improve performance using storage partitions when accessing entity data
19+
20+
An optional partition key can be specified to create a logical partition for non-relational custom entity data stored in NoSql tables of Azure heterogenous storage ([Cosmos DB](/azure/cosmos-db/introduction)). Having a partition key improves application performance for large sets of data (millions of records) by grouping data items into logical sets within a table. For example, a table containing products can be grouped logically into product categories to improve retrieval of all items within a product category. The partition key value can be a string or numeric type. Once specified, the partition key value can't be changed.
21+
22+
When no partition key is specified, the table is the logical boundary and retrieving a single item or a set of logically related items from a large data set will not be as performant as when using a partition key.
23+
24+
## Creating and accessing a partition
25+
26+
A unique new partition key value must be used to create a new logical partition. The same value must be used to create additional items in the same logical partition and to retrieve, update, or delete items belonging to that logical partition.
27+
28+
```csharp
29+
public void Run(CrmServiceClient client)
30+
{
31+
// Create
32+
Entity entity = new Entity("new_msdyn_customer");
33+
entity["new_firstname"] = "Monica";
34+
entity["new_lastname"] = "Thompson";
35+
36+
// First use of the partition ID value during an entity Create operation
37+
// also creates the partition where that entity record is stored.
38+
entity["partitionid"] = "CustomerPartition";
39+
Guid id = client.Create(entity);
40+
41+
// Update
42+
UpdateRequest updateRequest = new UpdateRequest();
43+
entity = new Entity("new_msdyn_customer", id);
44+
entity["new_firstname"] = "Cora";
45+
//entity["new_lastname"] = "Thomas";
46+
entity["partitionid"] = "CustomerPartition";
47+
updateRequest.Target = entity;
48+
var updateResponse = (UpdateResponse)client.Execute(updateRequest);
49+
50+
// Retrieve
51+
RetrieveRequest request = new RetrieveRequest();
52+
request.ColumnSet = new ColumnSet("new_firstname");
53+
request.Target = new EntityReference("new_msdyn_customer", id);
54+
request["partitionId"] = "CustomerPartition";
55+
var response = (RetrieveResponse)client.Execute(request);
56+
57+
// RetrieveMultiple
58+
RetrieveMultipleRequest retreiveMultipleRequest = new RetrieveMultipleRequest();
59+
retreiveMultipleRequest.Query = new QueryExpression()
60+
{
61+
EntityName = "new_msdyn_customer",
62+
ColumnSet = new ColumnSet("new_firstname")
63+
};
64+
retreiveMultipleRequest["partitionId"] = "CustomerPartition";
65+
var retrieveResponse = (RetrieveMultipleResponse)client.Execute(retreiveMultipleRequest);
66+
67+
// Update and insert
68+
UpsertRequest upsertRequest = new UpsertRequest();
69+
entity = new Entity("new_msdyn_customer", id);
70+
entity["new_firstname"] = "Andre";
71+
entity["new_lastname"] = "Lawson";
72+
entity["partitionid"] = "CustomerPartition";
73+
upsertRequest.Target = entity;
74+
var upsertResponse = (UpsertResponse)client.Execute(upsertRequest);
75+
76+
// Delete
77+
DeleteRequest deleteRequest = new DeleteRequest();
78+
deleteRequest.Target = new EntityReference("new_msdyn_customer", id);
79+
deleteRequest["partitionId"] = "CustomerPartition";
80+
var deleteResponse = (DeleteResponse)client.Execute(deleteRequest);
81+
}
82+
```
83+
84+
## Additional information
85+
86+
Here are a few more details about the partition key and partition management.
87+
88+
- The key value must be unique in the environment.
89+
- A partition is limited to 20 GB of data, and there is no method available to check the partition's current size.
90+
- There is no defined limit to the number of partitions you can allocate in an environment.
91+
- Partition allocation is automatic. Specifying a unique partition key during a Create operation creates a partition. When all data has been deleted from the partition, the partition is automatically deleted.
92+
- There is no method available to rename a key.
93+
- Presently, only the Create, Update, Retrieve, and Delete entity operations support storage partitioning.
94+
95+
### See Also
96+
97+
[Passing optional parameters with a request](use-messages.md#passing-optional-parameters-with-a-request)
98+
[Create entities using the Organization Service](entity-operations-create.md)
99+
[Retrieve an entity using the Organization Service](entity-operations-retrieve.md)
100+
[Update and Delete entities using the Organization Service](entity-operations-update-delete.md)
101+
[Partitioning and horizontal scaling in Azure Cosmos DB](/azure/cosmos-db/partitioning-overview)

powerapps-docs/developer/data-platform/org-service/entity-operations-create.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Create entities using the Organization Service (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3-
description: "<Description>" # 115-145 characters including spaces. This abstract displays in the search result.
3+
description: "Learn how to create entities using the Organization Service." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
55
ms.date: 10/31/2018
66
ms.reviewer: "pehecke"
@@ -272,6 +272,10 @@ Another way to create an entity is by using the <xref:Microsoft.Xrm.Sdk.Messages
272272

273273
More information: [Use Upsert](entity-operations-update-delete.md#use-upsert)
274274

275+
## Create documents in storage partitions
276+
277+
If you are creating large numbers of entities that contain documents, you can create the entities in storage partitions to speed up access to those entity records. More information: [Improve performance when accessing documents using storage partitions](azure-storage-partitioning-sdk.md)
278+
275279

276280
### See also
277281

powerapps-docs/developer/data-platform/org-service/entity-operations-retrieve.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ Console.WriteLine(entity["name"]);
167167
> [!NOTE]
168168
> Alternate keys are usually used only for data integration scenarios
169169
170+
## Retrieve documents in storage partitions
171+
172+
If you are retrieving entity data stored in partitions be sure to specify the partition key when retrieving that entity data. More information: [Improve performance when accessing entity data using storage partitions](azure-storage-partitioning-sdk.md)
170173

171174
## Access Formatted values
172175

powerapps-docs/developer/data-platform/org-service/entity-operations-update-delete.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ More information:
246246
- [Work with alternate keys](../define-alternate-keys-entity.md)
247247
- [Use an alternate key to create a record](../use-alternate-key-create-record.md)
248248

249+
## Update and delete documents in storage partitions
250+
251+
If you are updating or deleting entity data stored in partitions be sure to specify the partition key when accessing that data. More information: [Improve performance when accessing entity data using storage partitions](azure-storage-partitioning-sdk.md)
252+
249253
## Use Upsert
250254

251255
Typically in data integration scenarios you will need to create or update data in Microsoft Dataverse from other sources. Dataverse may already have records with the same unique identifier, which may be an alternate key. If an entity record exists, you want to update it. If it doesn't exist, you want to create it so that the data being added is synchronized with the source data. This is when you want to use upsert.

powerapps-docs/developer/data-platform/org-service/use-messages.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Use messages with the Organization service (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "Understand how messages are used to invoke operations using the organization service." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
5-
ms.date: 11/26/2020
5+
ms.date: 01/25/2021
66
ms.reviewer: "pehecke"
77
ms.service: powerapps
88
ms.topic: "article"
@@ -84,13 +84,14 @@ More information:
8484

8585
## Passing optional parameters with a request
8686

87-
You can pass optional parameters in messages using the <xref:Microsoft.Xrm.Sdk.OrganizationRequest.Parameters> property that is exposed for all the *Request message classes in the SDK assemblies. There are two optional parameters you can pass with messages
87+
You can pass optional parameters in messages using the <xref:Microsoft.Xrm.Sdk.OrganizationRequest.Parameters> property that is exposed for all the *Request message classes in the SDK assemblies. There are several optional parameters you can pass with messages:
8888

8989
|Parameter|Description|Messages|
9090
|-----------------|-----------------|--------------|
9191
|`SolutionUniqueName`|A `String` that specifies the unique name of the solution to which the operation applies. More information: [Dependency tracking for solution components](/power-platform/alm/dependency-tracking-solution-components).|<xref:Microsoft.Crm.Sdk.Messages.AddPrivilegesRoleRequest> <br /> <xref:Microsoft.Xrm.Sdk.Messages.CreateRequest> <br /> <xref:Microsoft.Xrm.Sdk.Messages.DeleteRequest> <br /> <xref:Microsoft.Crm.Sdk.Messages.MakeAvailableToOrganizationTemplateRequest> <br /> <xref:Microsoft.Xrm.Sdk.Messages.UpdateRequest>|
9292
|`SuppressDuplicateDetection`|A `Boolean` used to disable duplicate detection on a create or update operation. More information: [Use SuppressDuplicateDetection parameter to throw errors when you create or update record](detect-duplicate-data.md#use-suppressduplicatedetection-parameter-to-throw-errors-when-you-create-or-update-record) .|<xref:Microsoft.Xrm.Sdk.Messages.CreateRequest> <br /> <xref:Microsoft.Xrm.Sdk.Messages.UpdateRequest>|
9393
|`tag`|A value to include within the `ExecutionContext` `SharedVariables` collection. |Any message that can have a plug-in step registered. More information: [Add a Shared Variable from the Organization Service](#add-a-shared-variable-from-the-organization-service)|
94+
|`PartitionId`| A unique `String` value used to access non-relational entity data in NoSql tables within a storage partition. Used to improve performance when accessing entity data in Azure heterogenous storage. <p/>More information: [Improve performance when accessing entity data using storage partitions](azure-storage-partitioning-sdk.md) |<xref:Microsoft.Xrm.Sdk.Messages.CreateRequest> <br /> <xref:Microsoft.Xrm.Sdk.Messages.UpdateRequest><br /> <xref:Microsoft.Xrm.Sdk.Messages.RetrieveRequest> <br /> <xref:Microsoft.Xrm.Sdk.Messages.DeleteRequest> |
9495

9596
The following sample shows how to pass an optional parameter:
9697

0 commit comments

Comments
 (0)