使用 Azure 表存储 API 和 Azure Cosmos DB 进行开发Developing with Azure Cosmos DB Table API and Azure Table storage

Azure Cosmos DB 表 API 和 Azure 表存储通过其 SDK 共享相同的表数据模型,并公开相同的创建、删除、更新和查询操作。Azure Cosmos DB Table API and Azure Table storage share the same table data model and expose the same create, delete, update, and query operations through their SDKs.

如果当前使用 Azure 表存储,那么改用 Azure Cosmos DB 表 API 可以获得以下好处:If you currently use Azure Table Storage, you gain the following benefits by moving to the Azure Cosmos DB Table API:

Azure 表存储Azure Table storage Azure Cosmos DB 表 APIAzure Cosmos DB Table API
延迟Latency 快速,但对延迟没有上限。Fast, but no upper bounds on latency. 读取操作和写入操作的低至个位数的毫秒级延迟(通过以下统计数据提供支持:在全球任何位置,对于任何规模,99% 的情况下读取操作的延迟 < 10 毫秒、写入操作的延迟 < 15 毫秒)。Single-digit millisecond latency for reads and writes, backed with <10-ms latency reads and <15-ms latency writes at the 99th percentile, at any scale, anywhere in the world.
吞吐量Throughput 可变吞吐量模型。Variable throughput model. 表的可伸缩性限制为 20,000 个操作/秒。Tables have a scalability limit of 20,000 operations/s. 使用 SLA 支持的每个表专用保留吞吐量实现高度可缩放。Highly scalable with dedicated reserved throughput per table that's backed by SLAs. 帐户没有吞吐量上限,每个表支持 >1000 万个操作/秒。Accounts have no upper limit on throughput and support >10 million operations/s per table.
全球分布Global distribution 具有一个可选可读辅助读取区域以实现高可用性的单一区域。Single region with one optional readable secondary read region for high availability. 不能启动故障转移。You can't initiate failover. 从 1 个到 30 多个区域进行统包式全局分发Turnkey global distribution from one to 30+ regions. 支持在全球各地随时自动和手动故障转移Support for automatic and manual failovers at any time, anywhere in the world.
索引Indexing 仅对 PartitionKey 和 RowKey 建立主索引。Only primary index on PartitionKey and RowKey. 没有辅助索引。No secondary indexes. 自动对所有属性完成编制索引,没有索引管理。Automatic and complete indexing on all properties, no index management.
查询Query 执行查询时使用主键的索引,否则进行扫描。Query execution uses index for primary key, and scans otherwise. 查询可以利用属性的自动索引缩短查询时间。Queries can take advantage of automatic indexing on properties for fast query times.
一致性Consistency 在主要区域内实现强一致性。Strong within primary region. 在辅助区域内实现最终一致性。Eventual within secondary region. 五个定义完善的一致性级别可基于应用程序需要权衡可用性、延迟、吞吐量和一致性。Five well-defined consistency levels to trade off availability, latency, throughput, and consistency based on your application needs.
定价Pricing 存储优化。Storage-optimized. 吞吐量优化。Throughput-optimized.
SLASLAs 99.99% 可用性。99.99% availability. 在公开发布时,为所有单区域帐户和具有松散一致性的所有多区域帐户提供 99.99% 的可用性 SLA,为所有多区域数据库帐户提供 99.999% 的读取可用性方面的行业领先的综合 SLA99.99% availability SLA for all single region accounts and all multi-region accounts with relaxed consistency, and 99.999% read availability on all multi-region database accounts Industry-leading comprehensive SLAs on general availability.

使用 Azure Cosmos DB 表 API 进行开发Developing with the Azure Cosmos DB Table API

当前,Azure Cosmos DB 表 API 具有四个可用于进行开发的 SDK:At this time, the Azure Cosmos DB Table API has four SDKs available for development:

  • Microsoft.Azure.Cosmos.Table: .NET SDK.Microsoft.Azure.Cosmos.Table: .NET SDK. 此库面向 .NET Standard,不仅与公共 Microsoft Azure 存储 SDK 具有相同的类和方法签名,而且还可以使用表 API 连接到 Azure Cosmos DB 帐户。This library targets .NET Standard and has the same classes and method signatures as the public Windows Azure Storage SDK, but also has the ability to connect to Azure Cosmos DB accounts using the Table API. 建议 .NET Framework 库 Microsoft.Azure.CosmosDB.Table 的用户升级到 Microsoft.Azure.Cosmos.Table,因为它处于维护模式并且很快将被弃用。Users of .NET Framework library Microsoft.Azure.CosmosDB.Table are recommended to upgrade to Microsoft.Azure.Cosmos.Table as it is in maintenance mode and will be deprecated soon.

  • Python SDK:新的 Azure Cosmos DB Python SDK 是在 Python 中唯一支持 Azure 表存储的 SDK。Python SDK: The new Azure Cosmos DB Python SDK is the only SDK that supports Azure Table storage in Python. 此 SDK 与 Azure 表存储和 Azure Cosmos DB 表 API 连接。This SDK connects with both Azure Table storage and Azure Cosmos DB Table API.

  • Java SDK:此 Azure 存储 SDK 能够使用表 API 连接到 Azure Cosmos DB 帐户。Java SDK: This Azure Storage SDK has the ability to connect to Azure Cosmos DB accounts using the Table API.

  • Node.js SDK:此 Azure 存储 SDK 能够使用表 API 连接到 Azure Cosmos DB 帐户。Node.js SDK: This Azure Storage SDK has the ability to connect to Azure Cosmos DB accounts using the Table API.

有关使用表 API 的其他信息可在常见问题解答:使用表 API 进行开发一文中找到。Additional information about working with the Table API is available in the FAQ: Develop with the Table API article.

使用 Azure 表存储进行开发Developing with Azure Table storage

Azure 表存储的以下 SDK 可用于开发:Azure Table storage has these SDKs available for development: