简体   繁体   English

Azure TableStorage-性能

[英]Azure TableStorage - Performance

I have to make a query on an Azure table storage where I have the following setup: RowKey, PartitionKey, ThirdColumn 我必须在具有以下设置的Azure表存储上进行查询: RowKey,PartitionKey,ThirdColumn

The RowKey is unique, and the Partitionkey corelates with ThirdColumn, meaning all third columns with the value " Y ", will have the partition key " X ". RowKey是唯一的,并且Partitionkey与ThirdColumn关联在一起,这意味着所有第三列的值为“ Y ”,都将具有分区键“ X ”。

I have to get all entities with partition key X , by using the ThirdColumn value. 我必须通过使用ThirdColumn值来获取所有具有分区键X的实体。 This will not be performant because Y is neither PartitionKey or RowKey. 由于Y既不是PartitionKey也不是RowKey,因此这将无法执行。

Question is: Does it make sense to do a .FirstOrDefault() on the third column, in order to get an entity (any entity), and then do a query using the PartitionKey ? 问题是:为了获取实体(任何实体),然后在第三列上执行.FirstOrDefault(),然后使用PartitionKey进行查询,是否有意义? I think it would be better because then it doesn't have to search on different machines for the data. 我认为这样会更好,因为那样就不必在其他计算机上搜索数据了。

Regards, 问候,

Why not make the PartitionKey a combined value of X and Y? 为什么不将PartitionKey设为X和Y的组合值? Like "MyValueofX_MyValueofY"? 像“ MyValueofX_MyValueofY”一样?

Or if you don't have the value of X when you query, just duplicate the information with a different order, for example: 或者,如果在查询时没有X的值,则只需以不同的顺序复制信息,例如:

PK: X RK: Z Column: Y PK:X RK:Z列:Y

PK: Y RK: Z Column: X PK:Y RK:Z列:X

That way, you can query the record when you have X and when you have Y. 这样,您可以在拥有X和Y时查询记录。

Check Designing a Scalable Partition Strategy . 检查设计可扩展分区策略

I think you can look at the articles below: 我认为您可以查看以下文章:

https://msdn.microsoft.com/en-us/library/azure/dd894039.aspx https://msdn.microsoft.com/zh-CN/library/azure/dd894039.aspx

and try this code to get the first 1 entity: 并尝试使用以下代码获取第一个1实体:

var query = (from entity in context.CreateQuery<Customer>("Top1Customers")
                 select entity).Take(1);

Then you can write it into a method called First() 然后可以将其写入名为First()的方法中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 访问Azure tabletorage - Accessing Azure tablestorage 适用于.NET 4.5的TableStorage Azure SDK - Azure SDK for TableStorage with .NET 4.5 TableStorage Azure 中未知实体的 DataServiceQuery - DataServiceQuery for unknown entity in TableStorage Azure TableQuery <T> 从Azure TableStorage过滤PartitionKey - TableQuery<T> from Azure TableStorage that filters on PartitionKey 获取Microsoft Azure Tablestorage中所有表的列表 - Get list of all tables in microsoft azure tablestorage Azure:如何保存IDictionary <String> 在TableStorage上? - Azure: How to save IDictionary<String> at TableStorage? 最佳实践是什么:将数据发布到azure iothub或直接发布到azure tabletorage - What is the best practice : to publish data to azure iothub or directly to azure tablestorage 迁移Azure SDK 1.6 TableStorage和写入/读取实体处理程序 - Migrating Azure SDK 1.6 TableStorage and Writing/Reading Entity handlers 在 C# .NET Core 中使用 Azure TableStorage - Nuget Package WindowsAzure.Storage Alternative - Using Azure TableStorage in C# .NET Core - Nuget Package WindowsAzure.Storage Alternative 如何将完整的对象添加到 Serilog Azure Tablestorage 接收器,该对象未在消息中写出? - How can I add a complete object to Serilog Azure Tablestorage sink, which is not written out in the message?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM