计算Azure表存储中分区内的行

编程入门 行业动态 更新时间:2024-10-26 22:28:12
本文介绍了计算Azure表存储中分区内的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

关于SO如何获得Azure存储表的总计行计数,我已经看到了各种围绕SO的问题,但是我想知道如何获得单个分区中的行数./p>

在将最小数量的实体数据加载到内存中时,我该怎么做?

解决方案

您可能已经知道Azure表中没有可用的Count之类的功能.为了获取分区(或表)中实体(行)的总数,您必须获取所有实体.

您可以使用称为Query Projection的技术来减少响应负载.查询投影使您可以指定要表服务返回的实体属性(列)的列表.由于您只对实体的总数感兴趣,因此建议您仅取回PartitionKey.您可能会发现此博客文章对理解查询投影很有帮助: blogs.msdn.microsoft/windowsazurestorage/2011/09/15/windows-azure-tables-introducing-upsert-and-query-projection/.

I've seen various questions around SO about how to get the total row count of an Azure storage table, but I want to know how to get the number of rows within a single partition.

How can I do this while loading a minimal amount of entity data into memory?

解决方案

As you may already know that there's no Count like functionality available in Azure Tables. In order to get the total number of entities (rows) in a Partition (or a Table), you have to fetch all entities.

You can reduce the response payload by using a technique called Query Projection. A query projection allows you to specify the list of entity attributes (columns) that you want table service to return. Since you're only interested in total count of entities, I would recommend that you only fetch PartitionKey back. You may find this blog post helpful for understanding about Query Projection: blogs.msdn.microsoft/windowsazurestorage/2011/09/15/windows-azure-tables-introducing-upsert-and-query-projection/.

更多推荐

计算Azure表存储中分区内的行

本文发布于:2023-11-22 09:10:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616825.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中分   区内   Azure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!